mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +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
|
||||
preset: string
|
||||
rollupConfig?: RollupConfig
|
||||
moduleSideEffects: string[]
|
||||
renderer: string
|
||||
serveStatic: boolean
|
||||
middleware: ServerMiddleware[]
|
||||
@ -79,6 +80,7 @@ export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): N
|
||||
node: undefined,
|
||||
preset: undefined,
|
||||
rollupConfig: undefined,
|
||||
moduleSideEffects: ['unenv/runtime/polyfill/'],
|
||||
renderer: undefined,
|
||||
serveStatic: undefined,
|
||||
middleware: [],
|
||||
|
@ -114,6 +114,11 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
||||
) {
|
||||
rollupWarn(warning)
|
||||
}
|
||||
},
|
||||
treeshake: {
|
||||
moduleSideEffects (id) {
|
||||
return nitroContext.moduleSideEffects.some(match => id.startsWith(match))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user