-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.prod.js
68 lines (61 loc) · 1.64 KB
/
webpack.config.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
56
57
58
59
60
61
62
63
64
65
66
67
68
const path = require('path')
const webpack = require('webpack')
const autoprefixer = require('autoprefixer')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const cssModules = '?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'
module.exports = {
entry: [
'./app/setup/index',
],
output: {
path: path.join(__dirname, 'build'),
filename: 'scripts/bundle.js',
},
resolve: {
alias: {
aphrodite: 'aphrodite/no-important',
},
},
plugins: [
new ExtractTextPlugin('css/styles.css', { allChunks: true }),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false,
},
}),
new CopyWebpackPlugin([
{ from: 'static/index-prod.html', to: 'index.html' },
{ from: 'static/404.html', to: '404.html' },
]),
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, 'app'),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader'),
},
{
test: /\.global\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader!postcss-loader'),
},
{
test: /^((?!\.global).)*\.scss$/,
loaders: ExtractTextPlugin.extract('style-loader', `css-loader${cssModules}!sass-loader!postcss-loader`),
},
],
},
postcss: [
autoprefixer({ browsers: ['last 2 versions'] }),
],
}