-
Notifications
You must be signed in to change notification settings - Fork 234
/
webpack.config.babel.js
63 lines (61 loc) · 1.4 KB
/
webpack.config.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import UglifyJsPlugin from 'uglifyjs-webpack-plugin';
import path from 'path';
const webpackConfig = {
context: __dirname,
devtool: 'source-map',
target: 'web',
entry: {
'react-input-range.css': './src/scss/index.scss',
'react-input-range.js': './src/js/index.js',
'react-input-range.min.js': './src/js/index.js',
},
output: {
filename: '[name]',
path: path.resolve(__dirname, 'lib/bundle'),
library: 'InputRange',
libraryTarget: 'umd',
},
module: {
rules: [
{
include: path.resolve(__dirname, 'src'),
loader: 'babel-loader',
test: /\.jsx?$/,
},
{
include: path.resolve(__dirname, 'src'),
loader: ExtractTextPlugin.extract({
use: ['css-loader', 'postcss-loader', 'sass-loader'],
}),
test: /\.scss$/,
},
],
},
plugins: [
new ExtractTextPlugin('[name]'),
new UglifyJsPlugin({
sourceMap: true,
test: /\.min\.js$/,
}),
],
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx'],
},
externals: {
react: {
amd: 'react',
commonjs: 'react',
commonjs2: 'react',
root: 'React',
},
'react-dom': {
amd: 'react-dom',
commonjs: 'react-dom',
commonjs2: 'react-dom',
root: 'ReactDOM',
},
},
};
export default webpackConfig;