执行 npm run build 之后的 dist 目录的静态资源的文件名多会追加上 hash 值,比如: page1.f151b4d3.js
那如果不要 hash 呢,你只需要配置 vue.config.js 文件中的 filenameHashing
官方文档也提到了因为 html 也是我们通过插件生成的,静态资源直接就 inject 进去的,所以,当 html 不是自动生成或者其他情况时候,就不能加 hash 了,可以配置 false。
filenameHashing: false
我们看看源码实现:
首先它是 vue.config.js
的一个配置,在文件 cli-service/lib/options.js
中:
默认值是 true
filenameHashing: true
先看 css 部分,在文件 cli-service/lib/config/css.js 中:
const filename = getAssetPath( options, `css/[name]${options.filenameHashing "htmlcode">const filename = getAssetPath( options, `js/[name]${isLegacyBundle "htmlcode">const path = require('path') module.exports = function getAssetPath (options, filePath, placeAtRootIfRelative) { return options.assetsDir ? path.posix.join(options.assetsDir, filePath) : filePath }以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
最新资源
- 《摇滚教父 伍佰黄金精选 2CD》 [WAV+CUE][1GB]
- 《凤凰传奇 我从草原来》[WAV/分轨][400MB]
- 《叶倩文 真心真意过一生》[WAV+CUE][400MB]
- 潘越云.1985-世间女子(滚石25周年经典复刻版)【
- 陈柏宇.2009-CANT.BE.HALF【SONY】【WAV+CUE】
- 李明依.1989-小女生【滚石】【WAV+CUE】
- 《李荣浩 新时代创作新人王》[WAV分轨][310MB]
- 《黑鸭子与马头琴 史上最动听草原音乐》[WAV+CU
- 《汽车发烧音乐精选CD18》[FLAC+CUE][7.1G]
- 郑希怡.2004-Perfect.Date【英皇娱乐】【FLAC分