-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.prod.js
65 lines (62 loc) · 1.75 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
56
57
58
59
60
61
62
63
64
65
const webpack = require('webpack');
const path = require('path');
const precss = require('precss');
const autoprefixer = require('autoprefixer');
const simpleVars = require('postcss-simple-vars');
const postcssMixins = require('postcss-mixins');
const postcssBEM = require('postcss-bem')({style: 'bem'});
const postcssNested = require('postcss-nested');
const colorFunctions = require('postcss-color-function');
const postcssImport = require('postcss-import');
const customMedia = require('postcss-custom-media');
const BUILD_DIR = path.resolve(__dirname, 'public');
const APP_DIR = path.resolve(__dirname, 'src');
const config = {
entry: APP_DIR + '/index.js',
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
module : {
loaders : [
{
test : /\.jsx?/,
include : APP_DIR,
exclude: /node_modules/,
loader : 'babel',
plugins: [
'transform-runtime',
'add-module-exports',
'transform-decorators-legacy',
]
},
{ test: /\.css$/, loader: "style-loader!css-loader!postcss-loader" },
{ test: /\.json$/, loaders: ['json-loader'] },
{
test: /masonry|imagesloaded|fizzy\-ui\-utils|desandro\-|outlayer|get\-size|doc\-ready|eventie|eventemitter/,
loader: 'imports?define=>false&this=>window'
}
]
},
postcss: function(webpack) {
return [
postcssImport({addDependencyTo: webpack}),
precss,
autoprefixer,
postcssMixins,
simpleVars,
colorFunctions,
postcssBEM,
postcssNested,
customMedia
];
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
})
]
};
module.exports = config;