-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
45 lines (44 loc) · 1.15 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
const { spawn } = require('child_process')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { merge } = require('webpack-merge')
const BundleAnalyzerPlugin =
require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const common = require('./webpack.common.js')
const { NODE_ENV } = require('./env.js')
const { scripts } = require('./scripts/devBuild.js')
module.exports = merge(common(NODE_ENV.DEV), {
devtool: false,
devServer: {
historyApiFallback: true,
hot: false,
proxy: [
{
context: ['/api'],
target: 'http://localhost:3001'
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'dev-webpack 学习',
chunks: ['index'],
template: './public/index.html',
inject: 'body',
templateParameters: {
scripts,
test: 'testing'
}
}),
// {
// apply: (compiler) => {
// compiler.hooks.done.tap('jest', () => {
// spawn('npm', ['test'], {
// stdio: 'inherit',
// shell: true
// })
// })
// }
// },
new BundleAnalyzerPlugin({ openAnalyzer: false }) // http://127.0.0.1:8888/
]
})