From 4079882bd4742128f233fe750b1ffe1ea383828d Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 6 May 2022 11:51:31 +0100 Subject: [PATCH] fix(vite): use `buildAssetsURL` for dynamic imports (#4844) --- packages/vite/src/plugins/dynamic-base.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/plugins/dynamic-base.ts b/packages/vite/src/plugins/dynamic-base.ts index 940d06e83f..a88d93e5c2 100644 --- a/packages/vite/src/plugins/dynamic-base.ts +++ b/packages/vite/src/plugins/dynamic-base.ts @@ -81,8 +81,8 @@ export const DynamicBasePlugin = createUnplugin(function (options: DynamicBasePl if (id === 'vite/preload-helper') { // Define vite base path as buildAssetsUrl (i.e. including _nuxt/) - s.prepend('import { buildAssetsDir } from \'#build/paths.mjs\';\n') - s.replace(/const base = ['"]\/__NUXT_BASE__\/['"]/, 'const base = buildAssetsDir()') + s.prepend('import { buildAssetsURL } from \'#build/paths.mjs\';\n') + s.replace(/const base = ['"]\/__NUXT_BASE__\/['"]/, 'const base = buildAssetsURL()') } // Sanitize imports