mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +00:00
fix(nuxt): treeshake <DevOnly>
with webpack (#21013)
Co-authored-by: Inesh Bose <56732164+ineshbose@users.noreply.github.com>
This commit is contained in:
parent
c37ebab1ef
commit
7cc7297ea7
@ -9,7 +9,7 @@ interface DevOnlyPluginOptions {
|
||||
sourcemap?: boolean
|
||||
}
|
||||
|
||||
export const DevOnlyPlugin = createUnplugin((options: DevOnlyPluginOptions) => {
|
||||
export const DevOnlyPlugin = createUnplugin((options: DevOnlyPluginOptions, meta) => {
|
||||
const DEVONLY_COMP_RE = /<(?:dev-only|DevOnly)>[\s\S]*?<\/(?:dev-only|DevOnly)>/g
|
||||
|
||||
return {
|
||||
@ -20,7 +20,7 @@ export const DevOnlyPlugin = createUnplugin((options: DevOnlyPluginOptions) => {
|
||||
const { type } = parseQuery(search)
|
||||
|
||||
// vue files
|
||||
if (pathname.endsWith('.vue') && (type === 'template' || !search)) {
|
||||
if (pathname.endsWith('.vue') && (meta.framework === 'webpack' || type === 'template' || !search)) {
|
||||
return true
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user