-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.prod.js
More file actions
51 lines (46 loc) · 1.18 KB
/
webpack.config.prod.js
File metadata and controls
51 lines (46 loc) · 1.18 KB
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
var path = require('path')
var webpack = require('webpack')
var autoprefixer = require('autoprefixer');
var nodeModulesDir = path.resolve(__dirname, 'node_modules')
var plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
]
var devTool = ''
var babelPlugins = ['transform-proto-to-assign', 'transform-object-rest-spread']
var config = {
cache: true,
entry: {
app: './src/main.js',
},
devtool: devTool,
plugins,
output: { path: __dirname + '/dist', filename: 'bundle.js' },
module: {
noParse: [],
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
include: /src/,
exclude: [nodeModulesDir],
query: {
presets: ['es2015', 'react'],
plugins: babelPlugins,
},
},
{ test: /\.json$/, loader: 'json' },
{ test: /\.scss$/, loaders: ['style', 'css', 'postcss', 'sass?sourceMap'] },
{ test: /\.css$/, loaders: ['style', 'css', 'postcss'] },
],
},
postcss: [autoprefixer({ browsers: ['last 2 versions'] })],
}
module.exports = config