-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
70 lines (68 loc) · 1.99 KB
/
webpack.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
process.env.AWS_SERVICES = 'lambda'; // only include the AWS lambda sdk in the bundle
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const overrides = {
development: {
devtool: 'cheap-module-source-map',
},
test: {
devtool: 'eval',
entry: null,
quiet: true
},
production: {
watch: false,
output: {
filename: '[name].js',
chunkFilename: '[id].js'
},
plugins: [
new ExtractTextPlugin('components.css'),
new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}),
new webpack.IgnorePlugin(/^\.\/locale$/, [/moment$/]),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
})
]
}
};
module.exports = function(env) {
return Object.assign({
watch: true,
entry: {
application: './app/runtime/start.js'
},
externals: null,
module: {
loaders: [
{test: [/\.svg(\?|$)/, /\.png(\?|$)/, /\.jpg(\?|$)/, /\.eot(\?|$)/, /\.ttf(\?|$)/, /\.woff2?(\?|$)/], include: /node_modules/, loader: 'file?name=[name]-[hash].[ext]'},
{test: /\.css$/, exclude: /typography/, loader: ExtractTextPlugin.extract('css-loader?sourceMap')},
{test: /\.css$/, include: /typography/, loader: ExtractTextPlugin.extract('css-loader')},
{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'},
{test: /aws-sdk/, loaders: ['transform?aws-sdk/dist-tools/transform']},
{test: /\.json$/, loaders: ['json']}
]
},
output: {
filename: '[name].js',
chunkFilename: '[id].js',
pathinfo: true
},
resolve: {
root: [
path.resolve(`${__dirname}/app`),
path.resolve(`${__dirname}/node_modules`)
]
},
plugins: [
new ExtractTextPlugin('components.css'),
new webpack.IgnorePlugin(/^\.\/locale$/, [/moment$/])
],
node: {
fs: 'empty'
}
}, overrides[env]);
};