Skip to content

Commit 489cb11

Browse files
committed
ticket:23 Update and clean up 'webpack.config.js'
1 parent 1e10eb1 commit 489cb11

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

webpack.config.js

+23-33
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,45 @@
1-
var path = require('path');
2-
var webpack = require('webpack');
3-
var BundleTracker = require('webpack-bundle-tracker');
1+
/* global __dirname, module, require */
2+
const path = require('path');
3+
const webpack = require('webpack');
4+
const BundleTracker = require('webpack-bundle-tracker');
45

56
module.exports = {
6-
//the base directory (absolute path) for resolving the entry option
77
context: __dirname,
8-
//the entry point we created earlier. Note that './' means
9-
//your current directory. You don't have to specify the extension now,
10-
//because you will specify extensions later in the `resolve` section
118
entry: ['babel-polyfill', './assets/js/index'],
129

1310
output: {
14-
//where you want your compiled bundle to be stored
1511
path: path.resolve('./assets/bundles/'),
16-
//naming convention webpack should use for your files
17-
filename: '[name]-[hash].js'
12+
filename: '[name]-[hash].js',
1813
},
1914

2015
plugins: [
21-
//tells webpack where to store data about your bundles.
16+
// Store data about bundles in './webpack-stats.json'.
2217
new BundleTracker({filename: './webpack-stats.json'}),
23-
//makes jQuery available in every module
18+
// Make jQuery available in every module.
2419
new webpack.ProvidePlugin({
2520
$: 'jquery',
2621
jQuery: 'jquery',
27-
'window.jQuery': 'jquery'
28-
})
22+
'window.jQuery': 'jquery',
23+
}),
2924
],
3025

3126
module: {
32-
loaders: [
33-
//a regexp that tells webpack use the following loaders on all
34-
//.js and .jsx files
35-
{test: /\.jsx?$/,
36-
//we definitely don't want babel to transpile all the files in
37-
//node_modules. That would take a long time.
27+
rules: [
28+
{
29+
test: /\.jsx?$/,
3830
exclude: /node_modules/,
39-
//use the babel loader
40-
loader: 'babel-loader',
41-
query: {
42-
//specify that we will be dealing with React code
43-
presets: ['react', 'env']
44-
}
45-
}
46-
]
31+
use: {
32+
loader: 'babel-loader',
33+
options: {
34+
presets: ['react', 'env'],
35+
},
36+
},
37+
},
38+
],
4739
},
4840

4941
resolve: {
50-
//tells webpack where to look for modules
5142
modules: ['node_modules'],
52-
//extensions that should be used to resolve modules
53-
extensions: ['.js', '.jsx']
54-
}
55-
}
43+
extensions: ['.js', '.jsx'],
44+
},
45+
};

0 commit comments

Comments
 (0)