-
Notifications
You must be signed in to change notification settings - Fork 0
/
prod.client.config.js
52 lines (48 loc) · 1.45 KB
/
prod.client.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
46
47
48
49
50
51
52
const rucksack = require('rucksack-css')
const path = require('path')
const webpack = require('webpack')
const CleanPlugin = require('clean-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const webpackModule = require('./config/module.prod')
const projectRootPath = path.resolve(__dirname, '..')
const assetsPath = path.resolve(projectRootPath, 'static/dist')
const entry = require('./config/entry')
module.exports = {
devtool: 'source-map',
entry,
output: {
path: path.join(__dirname, '../static/dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
new CleanPlugin([assetsPath], { root: projectRootPath }),
new ExtractTextPlugin('style.css', { allChunks: true }),
new webpack.DefinePlugin({
'process.env': {
// Useful to reduce the size of client-side libraries, e.g. react
NODE_ENV: JSON.stringify('production')
}
}),
// optimizations
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
],
module: webpackModule,
resolve: {
modulesDirectories: ['src', 'node_modules'],
extensions: ['', '.js', '.jsx', '.css', '.scss']
},
postcss: [
rucksack({
autoprefixer: true
})
],
toolbox: { theme: './src/theme/theme.scss' }
}