fix(macros): ignore nullish id for transform (#3697)

This commit is contained in:
Anthony Fu 2022-03-16 18:52:05 +08:00 committed by GitHub
parent 7af60ca9b2
commit ae8b35173e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ export const TransformMacroPlugin = createUnplugin((options: TransformMacroPlugi
name: 'nuxt:pages-macros-transform',
enforce: 'post',
transformInclude (id) {
if (!id || id.startsWith('\x00')) { return }
const { search, pathname } = parseURL(id)
return pathname.endsWith('.vue') || !!parseQuery(search).macro
},