Created
December 1, 2021 19:14
-
-
Save protoEvangelion/3751e5a3085fd7fbdc675e35742be2d1 to your computer and use it in GitHub Desktop.
webpack dev server onCompile hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// unique port to this dev server | |
const port = 3000 | |
const webpackConfig = { | |
entry: '...', | |
output: '...', | |
devServer: { | |
host: '0.0.0.0', | |
public: `localhost:${port}`, | |
disableHostCheck: true, | |
port, | |
onListening: server => { | |
server.compiler.hooks.done.tap('done', () => { | |
setImmediate(() => { | |
process.send && process.send('ready'); | |
}); | |
}); | |
} | |
}, | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment