-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js
45 lines (44 loc) · 1.01 KB
/
webpack.config.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
var path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index.js',
library: 'ReactSpritz',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
rules: [
{
test: /(\.jsx|\.js)$/,
loader: 'babel-loader',
exclude: /(node_modules)/
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
'sass-loader',
],
}),
}],
},
plugins: [
new CleanWebpackPlugin(['build']),
new UglifyJSPlugin(),
new ExtractTextPlugin({
filename: "[name].css",
}),
],
externals: {
'react': 'react',
'react-dom': 'react-dom',
'prop-types': 'prop-types'
}
};