This Webpack plugin provide a way to inject inline chunks into the HTML file generated by the html-webpack-plugin. It differs from some other inline html webpack plugins in that the script to inject does not need to be specified as an explicit chunk or entry point. Further, the injected script is built according to the webpack loaders, and is not inlined raw.
Only Webpack 5 is supported.
yarn add -D inject-inline-html-webpack-plugin
Then instantiate the plugin after the HtmlWebpackPlugin, and specify a inlineScripts
in the html-webpack-plugin config:
plugins: [new HtmlWebpackPlugin({ inlineScripts: ['some-script.js'] }), new InjectInlineHtmlWebpackPlugin()]
Contributions are welcome!
Noah 🤔 💻 🚇 |
To add a contributor to the README, signal the all-contributors bot by adding comments in your PRs like so:
@all-contributors please add <username> for <contribution type>