Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): don't add macro query to the end of id (#5413)
Browse files Browse the repository at this point in the history
* fix(nuxt): don't add macro query to the end of id

* Update packages/nuxt/src/pages/macros.ts

Co-authored-by: pooya parsa <pyapar@gmail.com>
  • Loading branch information
dotoleeoak and pi0 committed Jun 12, 2022
1 parent a9c061c commit 95b38e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/nuxt/src/pages/macros.ts
Expand Up @@ -46,7 +46,10 @@ export const TransformMacroPlugin = createUnplugin((options: TransformMacroPlugi
// with workaround for vue-loader bug: https://github.com/vuejs/vue-loader/pull/1911
const scriptImport = findStaticImports(code).find(i => parseQuery(i.specifier.replace('?macro=true', '')).type === 'script')
if (scriptImport) {
const specifier = withQuery(scriptImport.specifier.replace('?macro=true', ''), { macro: 'true' })
// https://github.com/vuejs/vue-loader/pull/1911
// https://github.com/vitejs/vite/issues/8473
const parsed = parseURL(scriptImport.specifier.replace('?macro=true', ''))
const specifier = withQuery(parsed.pathname, { macro: 'true', ...parseQuery(parsed.search) })
s.overwrite(0, code.length, `export { meta } from "${specifier}"`)
return result()
}
Expand Down

0 comments on commit 95b38e2

Please sign in to comment.