forked from sat2707/technotrack-web2-spring-2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
67 lines (56 loc) · 1.67 KB
/
webpack.config.js
File metadata and controls
67 lines (56 loc) · 1.67 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
var webpack = require('webpack')
var BundleTracker = require('webpack-bundle-tracker')
const NODE_ENV = process.env.NODE_ENV || 'development'
module.exports = {
context: `${__dirname}/assets/js`,
entry: `${__dirname}/assets/js/index`,
output: {
path: `${__dirname}/static/bundles/`,
filename: NODE_ENV ? '[name].js' : "[name]-[hash].js",
},
plugins: [
new webpack.NoEmitOnErrorsPlugin,
new BundleTracker({filename: './webpack-stats.json'}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
include: `${__dirname}/assets/js/`,
loader: 'babel-loader?presets[]=react&presets[]=es2015&presets[]=stage-1'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader',
},
{
test: /\.scss$/,
loader: 'style-loader!css-loader',
},
{
test: /\.{png|jpg|gif|svg|ttf}$/,
loader: 'url-loader?limit=4096&name=[path]-[name].[ext]',
},
],
},
resolve: {
modules: ['node_modules', `${__dirname}/assets/js`],
extensions: ['.js', '.jsx'],
},
watch: NODE_ENV === 'development',
watchOptions: {
aggregateTimeout: 100,
},
devtool: NODE_ENV === 'development' ? 'eval-module-source-map' : false,
};
if (NODE_ENV !== 'development') {
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnigns: false,
drop_console: true,
unsafe: true,
},
})
);
}