-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.dev.js
62 lines (60 loc) · 1.44 KB
/
webpack.config.dev.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
const Path = require('path');
const Webpack = require('webpack');
const merge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const Autoprefixer = require('autoprefixer');
const common = require('./webpack.common.js');
const Config = require('../config.json');
module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
historyApiFallback: true,
host: '0.0.0.0',
publicPath: '/'
},
output: {
chunkFilename: 'js/[name].chunk.js'
},
plugins: [
new HtmlWebpackPlugin({
inject: true,
siteUrl: Config.devUrl,
template: Path.resolve(__dirname, '../src/index.html')
}),
new Webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
// new BundleAnalyzerPlugin()
],
module: {
rules: [
{
test: /\.js$/,
include: Path.resolve(__dirname, '../src'),
enforce: 'pre',
loader: 'eslint-loader',
options: {
emitWarning: true
}
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: (loader) => [
Autoprefixer
]
}
}
]
}
]
}
});