mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
perf(vite): bypass unchanged plugin transform (#3150)
This commit is contained in:
parent
cb663b0285
commit
b2438917b9
@ -44,5 +44,7 @@ function transform (content: string, components: Component[]) {
|
||||
return full
|
||||
})
|
||||
|
||||
if (!imports || newContent === content) { return }
|
||||
|
||||
return `${imports}\n${newContent}`
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export const TransformMacroPlugin = createUnplugin((options: TransformMacroPlugi
|
||||
}
|
||||
}
|
||||
|
||||
if (!parseQuery(search).macro) { return code }
|
||||
if (!parseQuery(search).macro) { return }
|
||||
|
||||
// [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
|
||||
|
@ -42,7 +42,8 @@ export const DynamicBasePlugin = createUnplugin(function (options: DynamicBasePl
|
||||
return null
|
||||
},
|
||||
enforce: 'post',
|
||||
transform (code, id) {
|
||||
transform (original, id) {
|
||||
let code = original
|
||||
if (options.globalPublicPath && id.includes('entry.ts')) {
|
||||
code = 'import { joinURL } from "ufo";' +
|
||||
`${options.globalPublicPath} = joinURL(NUXT_BASE, NUXT_CONFIG.app.buildAssetsDir);` + code
|
||||
@ -84,6 +85,7 @@ export const DynamicBasePlugin = createUnplugin(function (options: DynamicBasePl
|
||||
code = code.replace(delimiterRE, '`$1${NUXT_BASE}$2`')
|
||||
}
|
||||
|
||||
if (code === original) { return }
|
||||
return code
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user