From d2b022d313c39aa9c1e309a6167f4be699489fd4 Mon Sep 17 00:00:00 2001 From: richex-cn Date: Wed, 12 Oct 2022 22:31:22 +0800 Subject: [PATCH] docs: fix content hash of webpack example (fix #1728) (#1729) Co-authored-by: Frozen FIsh <76603360+sudongyuer@users.noreply.github.com> --- examples/vue-cli5/vue.config.js | 3 +++ packages/webpack/README.md | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/examples/vue-cli5/vue.config.js b/examples/vue-cli5/vue.config.js index da82d94779..ddb11dc698 100644 --- a/examples/vue-cli5/vue.config.js +++ b/examples/vue-cli5/vue.config.js @@ -5,6 +5,9 @@ module.exports = { plugins: [ UnoCSS(), ], + optimization: { + realContentHash: true, + }, }, chainWebpack(config) { config.module.rule('vue').uses.delete('cache-loader') diff --git a/packages/webpack/README.md b/packages/webpack/README.md index 0874c31a8f..1bbbe45308 100644 --- a/packages/webpack/README.md +++ b/packages/webpack/README.md @@ -20,9 +20,14 @@ module.exports = { plugins: [ UnoCSS({ /* options */ }), ], + optimization: { + realContentHash: true, + }, } ``` +> If you are using webpack@4.x, the `optimization.realContentHash` configuration is not supported, And you should remove it. Be aware of this [known issue](https://github.com/unocss/unocss/issues/1728) with bundle and [webpack#9520](https://github.com/webpack/webpack/issues/9520#issuecomment-749534245). + Add `uno.css` to your main entry: ```ts