Skip to content

Commit

Permalink
fix: persistent cache conflicts (#1131)
Browse files Browse the repository at this point in the history
Co-authored-by: brightwwu <brightwwu@tencent.com>
  • Loading branch information
wre232114 and brightwwu authored Apr 7, 2024
1 parent f6fa2f5 commit 9ae8643
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-gorillas-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@farmfe/core': patch
---

Fix persistent cache conflicts
2 changes: 1 addition & 1 deletion crates/core/src/cache/cache_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{

use crate::config::Mode;

const FARM_CACHE_VERSION: &str = "0.3.2";
const FARM_CACHE_VERSION: &str = "0.3.3";
const FARM_CACHE_MANIFEST_FILE: &str = "farm-cache.json";

// TODO make CacheStore a trait and implement DiskCacheStore or RemoteCacheStore or more.
Expand Down
7 changes: 6 additions & 1 deletion crates/plugin_css/src/transform_css_to_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ pub fn transform_css_to_script_modules(
let store_key = CacheStoreKey {
name: module_id.to_string() + "-transform_css_to_script_modules",
key: sha256(
format!("{}{}", content_hash, module_id.to_string()).as_bytes(),
format!(
"transform_css_to_script_modules_{}_{}",
content_hash,
module_id.to_string()
)
.as_bytes(),
32,
),
};
Expand Down
7 changes: 6 additions & 1 deletion crates/plugin_runtime/src/render_resource_pot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ pub fn resource_pot_to_runtime_object(
let store_key = CacheStoreKey {
name: m_id.to_string() + "-resource_pot_to_runtime_object",
key: sha256(
format!("{}{}", content_hash, m_id.to_string()).as_bytes(),
format!(
"resource_pot_to_runtime_object_{}_{}",
content_hash,
m_id.to_string()
)
.as_bytes(),
32,
),
};
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-adapter-vue/farm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function configureVitePluginVue() {
export default defineConfig({
compilation: {
// compilation options here
persistentCache: false
// persistentCache: false
},
plugins: [
'@farmfe/plugin-sass',
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-adapter-vue/src/components/Intro.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts"></script>

<template>
<p>
<p>
Install
<a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
in your IDE for a better DX
Expand Down

0 comments on commit 9ae8643

Please sign in to comment.