Real Content Hashing in Webpack 5with Rehash Plugin
rehash-webpack-plugin:计算Webpack 5中最终发出的资产的真实内容哈希。### 安装使用以下命令安装:- npm: npm i -D rehash-webpack-plugin
- yarn: yarn add --dev rehash-webpack-plugin
### 用法该插件会根据最终Webpack发出的资产内容计算哈希值,并替换JS/CSS文件名中的contenthash或chunkhash。只需按照以下步骤操作:1. 将插件添加到你的Webpack配置中。2. 根据生产环境设置适当的sourcemap文件导出。推荐使用以下设置方式: - devtool
设置为none
、source-map
、nosources-source-map
或hidden-nosources-source-map
。
7.82KB
文件大小:
评论区