大飞_dafei

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

html-webpack-plugin 配置项

html-webpack-plugin 配置项

// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
chainWebpack: (config) => {
    // html-webpack-plugin 配置 see https://www.npmjs.com/package/html-webpack-plugin
    config.plugin('html').tap(option => {
        option[0].title = "我是daFei_title" // 默认
        return option;
    })
},
<div>
    <%= htmlWebpackPlugin.options.title %>
    <%= htmlWebpackPlugin.options.filename %>
</div>

 

 相关配置项

NameTypeDefaultDescription
title {String} Webpack App The title to use for the generated HTML document
filename {String|Function} 'index.html' The file to write the HTML to. Defaults to index.html. You can specify a subdirectory here too (eg: assets/admin.html). The [name] placeholder will be replaced with the entry name. Can also be a function e.g. (entryName) => entryName + '.html'.
template {String} `` webpack relative or absolute path to the template. By default it will use src/index.ejs if it exists. Please see the docs for details
templateContent {string|Function|false} false Can be used instead of template to provide an inline template - please read the Writing Your Own Templates section
templateParameters {Boolean|Object|Function} false Allows to overwrite the parameters used in the template - see example
inject {Boolean|String} true true || 'head' || 'body' || false Inject all assets into the given template or templateContent. When passing 'body' all javascript resources will be placed at the bottom of the body element. 'head' will place the scripts in the head element. Passing true will add it to the head/body depending on the scriptLoading option. Passing false will disable automatic injections. - see the inject:false example
publicPath {String|'auto'} 'auto' The publicPath used for script and link tags
scriptLoading {'blocking'|'defer'|'module'} 'defer' Modern browsers support non blocking javascript loading ('defer') to improve the page startup performance. Setting to 'module' adds attribute type="module". This also implies "defer", since modules are automatically deferred.
favicon {String} `` Adds the given favicon path to the output HTML
meta {Object} {} Allows to inject meta-tags. E.g. meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}
base {Object|String|false} false Inject a base tag. E.g. base: "https://example.com/path/page.html
minify {Boolean|Object} true if mode is 'production', otherwise false Controls if and in what ways the output should be minified. See minification below for more details.
hash {Boolean} false If true then append a unique webpack compilation hash to all included scripts and CSS files. This is useful for cache busting
cache {Boolean} true Emit the file only if it was changed
showErrors {Boolean} true Errors details will be written into the HTML page
chunks {?} ? Allows you to add only some chunks (e.g only the unit-test chunk)
chunksSortMode {String|Function} auto Allows to control how chunks should be sorted before they are included to the HTML. Allowed values are 'none' | 'auto' | 'manual' | {Function}
excludeChunks {Array.<string>} `` Allows you to skip some chunks (e.g don't add the unit-test chunk)
xhtml {Boolean} false

官网文档html-webpack-plugin

文档2html-webpack-plugin

posted on   大飞_dafei  阅读(535)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
历史上的今天:
2018-12-03 vagrant box --ubuntu18 打包后,使用box 报错
点击右上角即可分享
微信分享提示