-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
52 lines (47 loc) · 1.45 KB
/
webpack.config.dev.js
File metadata and controls
52 lines (47 loc) · 1.45 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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const webpackBaseConfig = require('./webpack.config');
const openBrowserPlugin = require('open-browser-webpack-plugin');
const PORT = 8099;
webpackBaseConfig.entry = {
test: [path.join(__dirname, 'example/index.js')]
};
webpackBaseConfig.output = {
path: path.join(__dirname, 'dist'),
publicPath: '/',
filename: 'static/js/[name].[hash:8].js',
chunkFilename: 'static/js/[name].[hash:8].js'
};
webpackBaseConfig.plugins = webpackBaseConfig.plugins.concat([
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
new webpack.HotModuleReplacementPlugin(),
new FriendlyErrorsPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.join(__dirname, 'example/index.html'),
inject: 'body',
minify: {
removeComments: true,
collapseWhitespace: true
}
}),
new openBrowserPlugin({
url: 'http://localhost:' + PORT
})
]);
webpackBaseConfig.devServer = {
contentBase: path.resolve(__dirname, 'src'),
hot: true,
inline: false,
progress: true,
stats: {
color: true
},
port: process.env.PORT || PORT,
historyApiFallback: true
};
module.exports = webpackBaseConfig;