Skip to content

Commit

Permalink
fix: compat chain.cache true (#6824)
Browse files Browse the repository at this point in the history
  • Loading branch information
9aoy authored Feb 12, 2025
1 parent 96a8726 commit 37afe36
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/smart-tigers-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modern-js/uni-builder': patch
---

fix: compat chain.cache true
11 changes: 10 additions & 1 deletion packages/cli/uni-builder/src/shared/plugins/frameworkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const pluginFrameworkConfig = (configPath: string): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain(chain => {
if (!fs.existsSync(configPath)) {
// TODO: Support rspack after support `performance.buildCache.buildDependencies` configuration
if (!fs.existsSync(configPath) || api.context.bundlerType !== 'webpack') {
return;
}

Expand All @@ -16,6 +17,14 @@ export const pluginFrameworkConfig = (configPath: string): RsbuildPlugin => ({
return;
}

if (cache === true) {
chain.cache({
buildDependencies: {
frameworkConfig: [configPath],
},
});
}

cache.buildDependencies = {
...cache.buildDependencies,
frameworkConfig: [configPath],
Expand Down

0 comments on commit 37afe36

Please sign in to comment.