-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.compressed.js
95 lines (90 loc) · 2.15 KB
/
webpack.config.compressed.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var autoprefixer = require('autoprefixer');
var precss = require('precss');
var extractSass = new ExtractTextPlugin('main.css');
module.exports = {
module: {
loaders: [{
test: /\.jsx$/,
loader: 'babel',
query: {
presets: ['react', 'es2015-without-strict-loose']
}
}, {
test: /\.js$/,
loader: 'babel',
exclude: [
path.resolve(__dirname, "node_modules")
],
query: {
presets: ['es2015-without-strict-loose']
}
}, {
test: /\.scss$/,
loader: extractSass.extract('style-loader', 'css-loader!postcss-loader!sass-loader?outputStyle=compact&sourceMap=false&sourceMapContents=false')
}, {
test: /\.html$/,
loader: 'file?name=[name].[ext]'
}, {
test: /\/misc\/.*\.js$/,
loader: 'file?name=/misc/[name].[ext]'
}, {
test: /\.(png|jpg|jpeg|)$/,
loader: 'file?name=/images/[hash].[ext]'
}, {
test: /\.json$/,
loader: 'json-loader'
}]
},
postcss: function () {
return [autoprefixer, precss];
},
plugins: [
extractSass,
new webpack.optimize.CommonsChunkPlugin({
names: ['libraries-react', 'libraries-core']
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
warnings: false
}
})
],
entry: {
//3rd party libraries
'libraries-core': [
'bluebird',
'immutable',
'jsuri',
'moment',
'moment-timezone',
'redux',
'reselect',
'store-cacheable',
'superagent'
],
'libraries-react': [
'react',
'react-dom',
'react-router',
'react-redux',
'react-router-redux'
],
//application code
application: './web/app/application.jsx',
//mocks
'mocked-api': './web/app/mock/api.js',
'mocked-local-storage': './web/app/mock/local-storage.js'
},
output: {
path: './web/build',
publicPath: '/build',
filename: '[name].js'
}
}