mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +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: {
|
||||
load: {
|
||||
enforce: 'pre',
|
||||
handler (id, options) {
|
||||
handler (id) {
|
||||
if (id.startsWith(PREFIX)) {
|
||||
const helper = !options?.ssr || nitro.options.imports !== false ? '' : 'globalThis.'
|
||||
return `export default ${helper}__publicAssetsURL(${JSON.stringify(decodeURIComponent(id.slice(PREFIX.length)))})`
|
||||
return `import { publicAssetsURL } from '#build/paths.mjs';export default publicAssetsURL(${JSON.stringify(decodeURIComponent(id.slice(PREFIX.length)))})`
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user