mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
fix(vite): explicitly import publicAssetsURL
This commit is contained in:
parent
0cb095f1f9
commit
9d08cdfd1f
@ -24,10 +24,9 @@ export const VitePublicDirsPlugin = createUnplugin(() => {
|
|||||||
vite: {
|
vite: {
|
||||||
load: {
|
load: {
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
handler (id, options) {
|
handler (id) {
|
||||||
if (id.startsWith(PREFIX)) {
|
if (id.startsWith(PREFIX)) {
|
||||||
const helper = !options?.ssr || nitro.options.imports !== false ? '' : 'globalThis.'
|
return `import { publicAssetsURL } from '#build/paths.mjs';export default publicAssetsURL(${JSON.stringify(decodeURIComponent(id.slice(PREFIX.length)))})`
|
||||||
return `export default ${helper}__publicAssetsURL(${JSON.stringify(decodeURIComponent(id.slice(PREFIX.length)))})`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user