Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d08cdf

Browse files
committed
fix(vite): explicitly import publicAssetsURL
1 parent 0cb095f commit 9d08cdf

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/vite/src/plugins/public-dirs.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ export const VitePublicDirsPlugin = createUnplugin(() => {
2424
vite: {
2525
load: {
2626
enforce: 'pre',
27-
handler (id, options) {
27+
handler (id) {
2828
if (id.startsWith(PREFIX)) {
29-
const helper = !options?.ssr || nitro.options.imports !== false ? '' : 'globalThis.'
30-
return `export default ${helper}__publicAssetsURL(${JSON.stringify(decodeURIComponent(id.slice(PREFIX.length)))})`
29+
return `import { publicAssetsURL } from '#build/paths.mjs';export default publicAssetsURL(${JSON.stringify(decodeURIComponent(id.slice(PREFIX.length)))})`
3130
}
3231
}
3332
},

0 commit comments

Comments
 (0)