-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.dev.config.js
42 lines (35 loc) · 1.23 KB
/
webpack.dev.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
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = require('./webpack.base.config.js');
// Use webpack dev server
config.entry.webpack = [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
];
// override django's STATIC_URL for webpack bundles
config.output.publicPath = 'http://localhost:3000/assets/bundles/';
config.devtool = 'eval-source-map';
// Add HotModuleReplacementPlugin and BundleTracker plugins
config.plugins = config.plugins.concat([
new webpack.NoErrorsPlugin(),
new BundleTracker({ filename: 'webpack-stats.json' }),
new ExtractTextPlugin('react-toolbox.css', { allChunks: true }),
]);
// Add a loader for JSX files
config.module.loaders.push(
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['latest', 'react', 'stage-3'],
plugins: ['transform-runtime'],
},
},
{
test: /(\.scss|\.css)$/,
loader: ExtractTextPlugin.extract('style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass?sourceMap!toolbox')
}
);
module.exports = config;