fix(nuxt3): add macro transform to non-sfcs (#2804)

This commit is contained in:
Daniel Roe 2022-01-19 18:11:31 +00:00 committed by GitHub
parent f219f635ad
commit c1a68012ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,8 +12,8 @@ export const TransformMacroPlugin = createUnplugin((options: TransformMacroPlugi
name: 'nuxt-pages-macros-transform',
enforce: 'post',
transformInclude (id) {
// We only process SFC files for macros
return parseURL(id).pathname.endsWith('.vue')
const { search, pathname } = parseURL(id)
return pathname.endsWith('.vue') || parseQuery(search).macro
},
transform (code, id) {
const { search } = parseURL(id)