Closed sailormillet closed 4 years ago
should I use html-webpack-tags-plugin replace html-webpack-include-assets-plugin, they are the same plugin or different
html-webpack-tags-plugin
is the newer version, it works mostly the same except drops support for node versions < 8, and changes the configuration syntax.
I would recommend that you update to use the newer version, and for the configuration you posted above, change it to:
new HtmlWebpackTagsPlugin({
tags: [
'css/no-public-path.min.css',
'scripts/libraries/vendor.js',
'scripts/libraries/vendor2.js'
],
append: false,
})
As for the assets appearing twice, I suspect that you may be including the plugin 2 times in your webpack config. Please double check that, and if you still see the issue, it would be helpful if you could share your complete webpack configuration.
should I use html-webpack-tags-plugin replace html-webpack-include-assets-plugin, they are the same plugin or different
html-webpack-tags-plugin
is the newer version, it works mostly the same except drops support for node versions < 8, and changes the configuration syntax.I would recommend that you update to use the newer version, and for the configuration you posted above, change it to:
new HtmlWebpackTagsPlugin({ tags: [ 'css/no-public-path.min.css', 'scripts/libraries/vendor.js', 'scripts/libraries/vendor2.js' ], append: false, })
As for the assets appearing twice, I suspect that you may be including the plugin 2 times in your webpack config. Please double check that, and if you still see the issue, it would be helpful if you could share your complete webpack configuration.
thanks for your reply. I check my config. and find the config is right. maybe my project is Multi Page Application and I found that the assets is always equal to the project’s application pages. so I check differenthtml-webpack-tags-plugin
version's code. find something was different.
so I think html-webpack-tags-plugin
versions > 1.0.6, the project is Multi Page Application. will see the issue.
@sailormillet it's quite difficult to help debug your issues without seeing a more complete webpack config. Without more detail, the only things I can suggest are:
html-webpack-tags-plugin
files
option so the plugin only gets applied once for each single html file.@sailormillet Hopefully you've resolved your problems. I'm closing the issue, but feel free to open a new one if you're still having trouble!
I experienced this exact issue when using dependencies that used the older html-webpack-include-assets-plugin. upgrading to the tags version fixed it for me, but a lot of plugins out there still use the old one.
hello, @jaridmargolin ,In the previous version, html-webpack-include-assets-plugin@1.0.7, everything works fine. My colleague update the plugin, I see some errors. include assets will be append several times. this is code:
append the following into the index template html like this
should I use html-webpack-tags-plugin replace html-webpack-include-assets-plugin, they are the same plugin or different