-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
61 lines (57 loc) · 1.44 KB
/
webpack.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
'use strict';
let setting = require('./config');
let merge = require('webpack-merge');
let common = require('./webpack.common.js');
let webpack = require('webpack');
let config = merge(common, {
mode: 'development',
watch: true,
output: {
filename: '[name].[hash].js',
},
devtool: 'inline-source-map',
devServer: {
contentBase: setting.build.dist,
compress: true,
port: 9000,
host: 'localhost',
overlay: {
warnings: true,
errors: true
},
watchOptions: {
poll: true,
aggregateTimeout: 300,
ignored: /node_modules/
},
proxy: {
// "/api": {
// target: "https://localhost:3000",
// pathRewrite: {"^/api" : ""},
// secure: false,
// /*bypass: function(req, res, proxyOptions) {
// if (req.headers.accept.indexOf("html") !== -1) {
// console.log("Skipping proxy for browser request.");
// return "/index.html";
// }
// }*/
// }
},
before(app){
/*app.get('/some/path', function(req, res) {
res.json({ custom: 'response' });
});*/
}
}
});
config.plugins = (config.plugins || []).concat(
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
mode: 'development'
}),
new webpack.EnvironmentPlugin({
NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined
DEBUG: true
})
);
module.exports = config;