mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 15:50:32 +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
|
return full
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!imports || newContent === content) { return }
|
||||||
|
|
||||||
return `${imports}\n${newContent}`
|
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
|
// [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
|
// 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
|
return null
|
||||||
},
|
},
|
||||||
enforce: 'post',
|
enforce: 'post',
|
||||||
transform (code, id) {
|
transform (original, id) {
|
||||||
|
let code = original
|
||||||
if (options.globalPublicPath && id.includes('entry.ts')) {
|
if (options.globalPublicPath && id.includes('entry.ts')) {
|
||||||
code = 'import { joinURL } from "ufo";' +
|
code = 'import { joinURL } from "ufo";' +
|
||||||
`${options.globalPublicPath} = joinURL(NUXT_BASE, NUXT_CONFIG.app.buildAssetsDir);` + code
|
`${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`')
|
code = code.replace(delimiterRE, '`$1${NUXT_BASE}$2`')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (code === original) { return }
|
||||||
return code
|
return code
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user