mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 17:07:22 +00:00
fix(nitro): disable moduleSideEffects
by default (#377)
This commit is contained in:
parent
864d2683ab
commit
bad2a74805
@ -22,6 +22,7 @@ export interface NitroContext {
|
|||||||
node: boolean
|
node: boolean
|
||||||
preset: string
|
preset: string
|
||||||
rollupConfig?: RollupConfig
|
rollupConfig?: RollupConfig
|
||||||
|
moduleSideEffects: string[]
|
||||||
renderer: string
|
renderer: string
|
||||||
serveStatic: boolean
|
serveStatic: boolean
|
||||||
middleware: ServerMiddleware[]
|
middleware: ServerMiddleware[]
|
||||||
@ -79,6 +80,7 @@ export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): N
|
|||||||
node: undefined,
|
node: undefined,
|
||||||
preset: undefined,
|
preset: undefined,
|
||||||
rollupConfig: undefined,
|
rollupConfig: undefined,
|
||||||
|
moduleSideEffects: ['unenv/runtime/polyfill/'],
|
||||||
renderer: undefined,
|
renderer: undefined,
|
||||||
serveStatic: undefined,
|
serveStatic: undefined,
|
||||||
middleware: [],
|
middleware: [],
|
||||||
|
@ -114,6 +114,11 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
) {
|
) {
|
||||||
rollupWarn(warning)
|
rollupWarn(warning)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
treeshake: {
|
||||||
|
moduleSideEffects (id) {
|
||||||
|
return nitroContext.moduleSideEffects.some(match => id.startsWith(match))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user