Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack 文件指纹是什么 #24

Open
leslie1943 opened this issue Nov 20, 2020 · 0 comments
Open

webpack 文件指纹是什么 #24

leslie1943 opened this issue Nov 20, 2020 · 0 comments

Comments

@leslie1943
Copy link
Owner

文件指纹是什么? 怎么用?

文件指纹是打包后输出的文件名的后缀。

  • Hash:和整个项目的构建相关,只要项目文件有修改,整个项目构建的 hash 值就会更改
  • Chunkhash:和 Webpack 打包的 chunk 有关,不同的 entry 会生出不同的 chunkhash
  • Contenthash:根据文件内容来定义 hash,文件内容不变,则 contenthash 不变
  • JS文件指纹设置: outputfilename 中设置,使用 chunkhash
  • CSS的文件指纹设置: MiniCssExtractPlugin插件中的filename设置,使用contenthash
  • 图片的文件指纹设置: file-loader 中的 options中设置 使用 hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant