1.0.3 • Published 3 years ago

env-inject-body-webpack-plugin v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

env-inject-body-webpack-plugin

A HTML Webpack Plugin for injecting a custom string into the end of body of html-webpack-plugin output according to the environment. (inspired by inject-body-webpack-plugin)

Installation

npm i -D env-inject-body-webpack-plugin

Example

Input

webpack.config.js

import HtmlWebpackPlugin from "html-webpack-plugin"
import InjectBodyPlugin from "env-inject-body-webpack-plugin"

export default {
  mode: 'development',
  plugins: [
    new HtmlWebpackPlugin(),
    new InjectBodyPlugin({
      content: '<script src="index.js"></script>',
      env: ["development"]
    }),
  ],
}

Output

index.html

<html><body><script src="index.js"></script></body></html>

Options