From 73462fb619df4ff9f5c3ecb50a7760f547cb27cd Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 12 Jul 2022 11:33:01 +0100 Subject: [PATCH] fix(nuxt): only tree-shake composables on their own lines --- packages/nuxt/src/core/plugins/tree-shake.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nuxt/src/core/plugins/tree-shake.ts b/packages/nuxt/src/core/plugins/tree-shake.ts index a8fe2af4453..d967efa83de 100644 --- a/packages/nuxt/src/core/plugins/tree-shake.ts +++ b/packages/nuxt/src/core/plugins/tree-shake.ts @@ -10,17 +10,17 @@ interface TreeShakePluginOptions { } export const TreeShakePlugin = createUnplugin((options: TreeShakePluginOptions) => { - const COMPOSABLE_RE = new RegExp(`($|\\s+)(${options.treeShake.join('|')})(?=\\()`, 'gm') + const COMPOSABLE_RE = new RegExp(`($\\s+)(${options.treeShake.join('|')})(?=\\()`, 'gm') return { name: 'nuxt:server-treeshake:transfrom', enforce: 'post', transformInclude (id) { const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href)) - const { type, macro } = parseQuery(search) + const { type } = parseQuery(search) // vue files - if (pathname.endsWith('.vue') && (type === 'script' || macro || !search)) { + if (pathname.endsWith('.vue') && (type === 'script' || !search)) { return true }