Simplifies creation of HTML files to serve your webpack bundles
npm install sina-html-webpack-plugin
Plugin that simplifies creation of HTML files to serve your bundles
在社区版本的基础上增加的功能:
import url 注入打包出来的html
template功能和html-loader并存
``bash`
yarn add sina-html-webpack-plugin
import url需安装 marauder-umd-loader
`bash`
yarn add marauder-umd-loader
引用方式如下:
onlineUrl: 必须
inject: body(默认),head
type: js(默认),css
(tip: 如果引用的 js 为 mjs.sinaimg.cn/umd 下的 sina umd 组件,marauder-umd-loader 将对组件做版本限制,只引用一个版本,若引用多个版本将引入失败)
`js`
import "marauder-umd-loader?inject=body&type=js&onlineUrl=https://mjs.sinaimg.cn/wap/online/public/wapLogin/wapLogin_main.js!@mfelibs/base-tools-SUDA";
This is a webpack plugin that simplifies creation of HTML files to serve your webpack bundles. This is especially useful for webpack bundles that include a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you, supplylodash
your own template using templates or use your own loader.
The html-webpack-plugin provides hooks to extend it to your needs. There are already some really powerful plugins which can be integrated with zero configuration
* webpack-subresource-integrity for enhanced asset security
* appcache-webpack-plugin for iOS and Android offline usage
* favicons-webpack-plugin which generates favicons and icons for iOS, Android and desktop browsers
* html-webpack-harddisk-plugin can be used to always write to disk the html file, useful when webpack-dev-server / HMR are being used
* html-webpack-inline-source-plugin to inline your assets in the resulting HTML file
* html-webpack-inline-svg-plugin to inline SVGs in the resulting HTML file.
* html-webpack-exclude-assets-plugin for excluding assets using regular expressions
* html-webpack-include-assets-plugin for including lists of js or css file paths (such as those copied by the copy-webpack-plugin).
* script-ext-html-webpack-plugin to add async, defer or module attributes to your