inject-body-compaticity-webpack-plugin
v1.0.0
Published
Webpack plugin that injects a custom string into the body of the html-webpack-plugin output.It is compatible with different versions of WebPack and HtmlWebPackPlugin
Downloads
3
Maintainers
Readme
inject-body-compaticity-webpack-plugin Introduction
A HTML Webpack Plugin that injects a custom string into the body of the html-webpack-plugin output.It is compatible with different versions of WebPack and HtmlWebPackPlugin. (inspired by inject-body-webpack-plugin)
Differences with inject-body-webpack-plugin
- It is compatible with different versions of WebPack and HtmlWebPackPlugin.
- It can work according to process.env.NODE_ENV.
Installation
npm i -D inject-body-compaticity-webpack-plugin
Example
Input
webpack.config.js
import HtmlWebpackPlugin from "html-webpack-plugin"
import InjectBodyCompaticityWebpackPlugin from "inject-body-compaticity-webpack-plugin"
export default {
mode: 'development',
plugins: [
new HtmlWebpackPlugin(),
new InjectBodyCompaticityWebpackPlugin({
position:'start',
content: '<script>alert("Hello InjectBodyCompaticityWebpackPlugin!")</script>',
env: ["development"]
}),
],
}
Output
index.html
<html><body><script>alert("Hello InjectBodyCompaticityWebpackPlugin!")</script></body></html>