fix(vite): exclude packages from deno cache in prefresh (#3374)

When disabling `node_modules` directory in Deno, prefresh plugin
transforms files in ~/.cache/deno/npm/registry.npmjs.org/ directory,
causing an arcane error to occur:
https://github.com/preactjs/prefresh/issues/124

After disabling this transform my site now works on updated fresh
version

I'm not sure if is the correct way to exclude this, but I don't see any
longer pattern that would work here

The cache is stored in $XDG_CACHE_HOME/deno/npm/$REGISTRY_HOST, where
only deno/npm part seems to be static

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
Lach
2025-09-12 18:17:36 +02:00
committed by GitHub
co-authored by Marvin Hagemeister
parent 7999d500f8
commit dd41a8706b
+1 -1
View File
@@ -174,7 +174,7 @@ export function fresh(config?: FreshViteConfig): Plugin[] {
...devServer(),
prefresh({
include: [/\.[cm]?[tj]sx?$/],
exclude: [/node_modules/],
exclude: [/node_modules/, /[\\/]+deno[\\/]+npm[\\/]+/],
parserPlugins: [
"importMeta",
"explicitResourceManagement",