Skip to content

Commit

Permalink
fix: hotfix vercel cache and modify chunk name to avoid cache (RSSNex…
Browse files Browse the repository at this point in the history
…t#904)

* fix(vercel): filter subpath

Signed-off-by: Innei <tukon479@gmail.com>

* update

---------

Signed-off-by: Innei <tukon479@gmail.com>
  • Loading branch information
Innei authored Oct 12, 2024
1 parent 6392f55 commit 570506c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions plugins/vite/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export function createDependencyChunksPlugin(dependencies: string[] | string[][]
const { output } = config.build.rollupOptions
const outputConfig = Array.isArray(output) ? output[0] : output
outputConfig.manualChunks = outputConfig.manualChunks || {}
outputConfig.assetFileNames = "assets/[name].[hash][extname]"
outputConfig.assetFileNames = "assets/[name].[hash:6][extname]"
outputConfig.chunkFileNames = (chunkInfo) => {
return chunkInfo.name.startsWith("vendor/") ? "[name].[hash].js" : "assets/[name].[hash].js"
return chunkInfo.name.startsWith("vendor/")
? "[name].[hash].js"
: "assets/[name].[hash:9].js"
}

const manualChunks = Array.isArray(output) ? output[0].manualChunks : output.manualChunks
Expand All @@ -22,7 +24,7 @@ export function createDependencyChunksPlugin(dependencies: string[] | string[][]

dependencies.forEach((dep, index) => {
if (Array.isArray(dep)) {
const chunkName = `vendor/a${index}`
const chunkName = `vendor/${index}`
manualChunks[chunkName] = dep
} else {
manualChunks[`vendor/${dep}`] = [dep]
Expand Down
2 changes: 1 addition & 1 deletion vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"destination": "/__debug_proxy.html"
},
{
"source": "/(.*)",
"source": "/((?!assets|vendor|locales/).*)",
"destination": "/index.html"
}
],
Expand Down

0 comments on commit 570506c

Please sign in to comment.