-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.local.config.js
69 lines (59 loc) · 1.39 KB
/
webpack.local.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
const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const path = require('path');
const baseConfig = require('./webpack.base.config');
const nodeModulesDir = path.resolve(__dirname, 'node_modules')
baseConfig.mode = 'development';
baseConfig.entry = [
'react-hot-loader/patch',
'whatwg-fetch',
'@babel/polyfill',
'./frontend/js/index.js',
];
baseConfig.output = {
path: path.resolve('./frontend/bundles/'),
publicPath: 'http://localhost:3000/frontend/bundles/',
filename: '[name].js',
};
baseConfig.optimization = {
splitChunks: {
chunks: 'all',
},
};
baseConfig.module.rules.push(
{
test: /\.jsx?$/,
exclude: [nodeModulesDir],
use: {
loader: 'babel-loader',
}
},
{
test: /\.(woff(2)?|eot|ttf)(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: 'url-loader',
options: {
limit: 100000
}
}
}
);
baseConfig.plugins.push(
new webpack.EvalSourceMapDevToolPlugin({
exclude: /node_modules/
}),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(), // don't reload if there is an error
new BundleTracker({
path: __dirname,
filename: './webpack-stats.json',
}),
new webpack.LoaderOptionsPlugin({
options: {
context: __dirname,
postcss: [autoprefixer],
},
}),
);
module.exports = baseConfig;