auto-insert-assets-to-html
v1.0.1
Published
用于 Webpack 打包时,自动插入CDN链接到HTML
Downloads
4
Readme
aoto-insert-assets-to-html
用于 Webpack 打包时,自动插入CDN链接到HTML
Usage
webpack.config.js
const AutoInsertAssetsToHmtl = require('auto-insert-assets-to-html')
module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
new AutoInsertAssetsToHmtl({
location: '</title>',
urls: [
{
tag: 'link',
url: 'https://unpkg.com/element-ui/lib/theme-chalk/index.css',
load: 'preload'
},
{
tag: 'script',
url: 'https://unpkg.com/[email protected]/dist/vue.runtime.min.js',
load: 'preload'
}
]
})
]
}
| name | type | description | | ---- | ---- | ---- | | location | String | insert on position | urls | Array | urls | UrlType | { tag: 'link' | 'script', url: string, load: 'preload' | 'prefetch' | null } | url