Skip to content

Commit 644c6c7

Browse files
authored
Merge pull request #144 from dev-five-git/fix-vite-cache-issue
Fix vite cache issue
2 parents ba15b3e + e644b46 commit 644c6c7

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

.changeset/quick-lands-share.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/wasm": patch
3+
---
4+
5+
Remove print

.changeset/soft-rivers-sit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/vite-plugin": patch
3+
---
4+
5+
Fix vite cache issue

libs/extractor/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,6 @@ import {Button} from '@devup/ui'
21682168
}
21692169
)
21702170
.unwrap());
2171-
println!("=================");
21722171

21732172
reset_class_map();
21742173
assert_debug_snapshot!(extract(

libs/extractor/src/style_extractor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ pub fn extract_style_from_expression<'a>(
146146
obj.properties.insert(idx, prop);
147147
}
148148
}
149-
println!("ORDER! {:?}", style_order);
150149
if props_styles.is_empty() {
151150
ExtractResult::Maintain
152151
} else {

packages/vite-plugin/src/__tests__/plugin.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,18 +328,19 @@ describe('devupUIPlugin', () => {
328328
expect(
329329
(plugin as any)
330330
.resolveId(cssFile, 'code')
331-
.startsWith('devup-ui.css?v='),
331+
.startsWith('devup-ui.css?t='),
332332
).toBe(true)
333333
})
334334
it('should load', () => {
335+
Date.now = () => 1
335336
expect((plugin as any).load('code')).toBeUndefined()
336337
expect((plugin as any).load(cssFile)).toBeUndefined()
337338
expect(
338339
(plugin as any).load('devup-ui.css?v=some').length.toString(),
339340
).toBe(
340341
(plugin as any)
341342
.resolveId(cssFile, 'code')
342-
.substring('devup-ui.css?v='.length),
343+
.substring(`devup-ui.css?v=${Date.now()}`.length),
343344
)
344345
})
345346
})

packages/vite-plugin/src/plugin.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ export function DevupUI({
108108
}
109109
},
110110
resolveId(id) {
111-
if (normalizePath(id) === normalizePath(cssFile)) {
112-
return 'devup-ui.css?v=' + globalCss.length
113-
}
111+
if (normalizePath(id) === normalizePath(cssFile))
112+
return `devup-ui.css?t=${Date.now().toString() + globalCss.length}`
114113
},
115114
load(id) {
116115
if (id.split('?')[0] === 'devup-ui.css') return globalCss

0 commit comments

Comments
 (0)