mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
fix(nuxt): don't add macro query to the end of id (#5413)
* 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>
This commit is contained in:
parent
a9c061cd2e
commit
95b38e241d
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user