-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
executable file
·80 lines (75 loc) · 1.75 KB
/
webpack.config.js
File metadata and controls
executable file
·80 lines (75 loc) · 1.75 KB
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
'use strict';
const webpack = require('webpack'),
autoprefixer = require('autoprefixer'),
path = require('path');
let config = {
cache: true,
entry: {
// Add any third party modules you'd like included on all pages.
'vendor': [
'react',
'react-dom'
],
// Auto-detect all components in directory.
'html': './src/index.html',
'code': './src/code.js',
},
output: {
path: './dist',
filename: 'bundle--[name].js',
},
resolve: {
// NOTE: Also add the same paths near the top of the gulp file where we
// include app-module-path.
modulesDirectories: [
'components',
'helpers',
'node_modules',
],
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
// Javascript: js, jsx
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
plugins: ['transform-runtime'],
presets: ['react', 'es2015', 'stage-0']
}
},
// CSS: scss, css
{
test: /\.s?css$/,
loaders: ['style', 'css', 'sass', 'postcss-loader']
},
// HTML: htm, html
{
test: /\.html?$/,
loader: "file?name=[name].[ext]"
}
]
},
postcss: [ autoprefixer({ browsers: ['last 12 versions'] }) ],
plugins: [
// Use the production version of third party libraries.
new webpack.DefinePlugin({
'process.env':{
'NODE_ENV': JSON.stringify('production')
}
}),
// Minify assets.
new webpack.optimize.UglifyJsPlugin({
mangle: true,
output: {
comments: false
},
compress: {
warnings: false // https://github.com/webpack/webpack/issues/1496
}
})
]
};
module.exports = config;