mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
fix(nuxt3): re-enable tree-shaking definePageMeta
(#3180)
This commit is contained in:
parent
6d4eb3da26
commit
e727bb4192
@ -13,9 +13,10 @@ export const TransformMacroPlugin = createUnplugin((options: TransformMacroPlugi
|
||||
enforce: 'post',
|
||||
transformInclude (id) {
|
||||
const { search, pathname } = parseURL(id)
|
||||
return pathname.endsWith('.vue') || parseQuery(search).macro
|
||||
return pathname.endsWith('.vue') || !!parseQuery(search).macro
|
||||
},
|
||||
transform (code, id) {
|
||||
const originalCode = code
|
||||
const { search } = parseURL(id)
|
||||
|
||||
// Tree-shake out any runtime references to the macro.
|
||||
@ -27,7 +28,9 @@ export const TransformMacroPlugin = createUnplugin((options: TransformMacroPlugi
|
||||
}
|
||||
}
|
||||
|
||||
if (!parseQuery(search).macro) { return }
|
||||
if (!parseQuery(search).macro) {
|
||||
return originalCode === code ? undefined : code
|
||||
}
|
||||
|
||||
// [webpack] Re-export any imports from script blocks in the components
|
||||
// with workaround for vue-loader bug: https://github.com/vuejs/vue-loader/pull/1911
|
||||
|
@ -25,7 +25,7 @@ declare module 'vue-router' {
|
||||
const warnRuntimeUsage = (method: string) =>
|
||||
console.warn(
|
||||
`${method}() is a compiler-hint helper that is only usable inside ` +
|
||||
'<script setup> of a single file component. Its arguments should be ' +
|
||||
'the script block of a single file component. Its arguments should be ' +
|
||||
'compiled away and passing it at runtime has no effect.'
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user