Skip to content

Commit

Permalink
fix(vite): use buildAssetsURL for dynamic imports (nuxt#4844)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored May 6, 2022
1 parent 27d6736 commit 4079882
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/plugins/dynamic-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4079882

Please sign in to comment.