-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
55 lines (54 loc) · 1.36 KB
/
webpack.prod.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
const path = require( 'path' );
const webpack = require( 'webpack' );
const Clean = require( 'clean-webpack-plugin' );
const ExtractText = require( 'extract-text-webpack-plugin' );
module.exports = {
context: path.resolve( __dirname, './src' ),
entry: path.resolve( __dirname, './src/index.js' ),
output: {
path: path.resolve( __dirname, './dist' ),
filename: 'index.js',
library: 'flex-react',
libraryTarget: 'umd',
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node-modules/,
loader: 'babel-loader',
},
{
test: /\.scss$/,
use: ExtractText.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader', 'sass-loader'],
}),
}
],
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new Clean(['dist'], { root: path.resolve( __dirname, './' )}),
new webpack.optimize.UglifyJsPlugin({
output: {
comments: false
},
compress: {
unused: true,
warnings: false,
comparisons: true,
conditionals: true,
dead_code: true,
if_return: true,
join_vars: true,
evaluate: true,
},
}),
new webpack.LoaderOptionsPlugin({ minimize: true, debug: false }),
new webpack.NamedModulesPlugin(),
new ExtractText( 'style.css' ),
],
};