jantimon/html-webpack-plugin

chunks does't work in webpack.config.ts

fancyhejianyang opened this issue · 1 comments

Current behaviour

in development mode,js files cannot be injected to html files when using typescript edit webpack.cofig.ts,
in other words,it can work if i using webpack.config.js amazing!

Expected behaviour ☀️

i want js files can be injected when using typescript dev.
current html:
image

Reproduction Example 👾

this is core code:
//webpack.config.ts entry: { download: './pages/download/index.ts', invitation: './pages/invitation/index.ts' }, output: { path: path.resolve(__dirname,'dist'), filename: '[name].js', clean: true, }, plugins: [ new HtmlWebpackPlugin({ template: './pages/download/index.html', filename: 'download.html', chunks: ['download'], inject:'body', scriptLoading: "blocking", }), new HtmlWebpackPlugin({ template: './pages/invitation/index.html', filename: 'invitation.html', chunks: ['invitation'], inject:'head', scriptLoading: "blocking", }), new MiniCssExtractPlugin({ insert: 'body' }) ]

Environment 🖥

node: v14.3.0
npm: v6.14.5
webpack: v5.51.1
html-webpack-plugin: v5.3.2

npm script: webpack-dev-server --mode=development

Remove chunks: ['invitation']