1 | exports.name = 'builtin:config-dev'
|
2 |
|
3 | exports.extend = api => {
|
4 | if (!api.isCommand('dev')) return
|
5 | api.chainWebpack(config => {
|
6 | if (config.entryPoints.has('index')) {
|
7 | config
|
8 | .entry('index')
|
9 | .prepend(require.resolve('@poi/dev-utils/hotDevClient'))
|
10 | }
|
11 |
|
12 | if (api.config.devServer.hot !== false) {
|
13 | const { HotModuleReplacementPlugin } = require('webpack')
|
14 | HotModuleReplacementPlugin.__expression = `require('webpack').HotModuleReplacementPlugin`
|
15 |
|
16 | config.plugin('hmr').use(HotModuleReplacementPlugin)
|
17 | }
|
18 | })
|
19 | }
|