-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Bug report
When I try lazy compilation, I find that the first time I open the page is always blank.
Here is a simple repo to reproduce: https://github.com/await-ovo/webpack5-lazy
git clone https://github.com/await-ovo/webpack5-lazy
cd webpack5-lazy && yarn
yarn dev
Then open localhost:8080/a.html
, you can see that the page is empty:
This is my webpack config:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'development',
entry: {
a: path.resolve('./src/a.js'),
b: path.resolve('./src/b.js')
},
devtool: 'cheap-module-source-map',
devServer: {
dev: {
writeToDisk: true,
}
},
optimization: {
runtimeChunk: true,
},
experiments: {
lazyCompilation: true,
},
plugins: [
new HtmlWebpackPlugin({
filename: 'a.html',
template: path.resolve('./index.html'),
chunks:['a']
}),
new HtmlWebpackPlugin({
filename: 'b.html',
chunks:['b'],
template: path.resolve('./index.html')
})
]
}
What is the current behavior?
The page opens blank in the browser and must be refreshed manually
If the current behavior is a bug, please provide the steps to reproduce.
Reproduction steps are as described above
What is the expected behavior?
It should display content correctly.
Other relevant information:
Once the runtimeChunk is commented out, everything works fine.
If it's a bug, I'm happy to help fix it, but I need some guidance, thanks~
webpack version: 5.34
Node.js version: 14
Operating System: macos
Additional tools: