Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/nuxt/src/core/plugins/tree-shake.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
}

Expand Down