html-webpack-inject-plugin
inject external tag to html
Installation
npm install --save-dev html-webpack-inject-plugin
Usage
Require the plugin in your webpack config
import HtmlWebpackInjectPlugin from 'html-webpack-inject-plugin'
// or
const HtmlWebpackInjectPlugin = require('html-webpack-inject-plugin').default
Add the plugin to your webpack config as follows
plugins: [
new HtmlWebpackPlugin(),
new HtmlWebpackInjectPlugin({
externals: [
{
tagName: 'script',
attributes: {
src: 'your-script.js',
type: 'text/javascript'
}
}
],
prepend: true // default is false
})
]
Options
externals: <HTMLTagObject>[]
: external HTMLTagObject which you want to addprepend
: insert before parent first child