refactor(nitro): move wasm support behind a flag (nitro.experiments.wasm) (#1045)

This commit is contained in:
Daniel Roe 2021-10-14 19:57:23 +01:00 committed by GitHub
parent 6e787c20ec
commit 6acfdcd0f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -35,6 +35,9 @@ export interface NitroContext {
esbuild?: {
options?: EsbuildOptions
}
experiments?: {
wasm?: boolean
}
moduleSideEffects: string[]
renderer: string
serveStatic: boolean
@ -94,6 +97,7 @@ export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): N
node: undefined,
preset: undefined,
rollupConfig: undefined,
experiments: {},
moduleSideEffects: ['unenv/runtime/polyfill/'],
renderer: undefined,
serveStatic: undefined,

View File

@ -143,7 +143,9 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
rollupConfig.plugins.push(raw())
// WASM import support
rollupConfig.plugins.push(wasmPlugin())
if (nitroContext.experiments.wasm) {
rollupConfig.plugins.push(wasmPlugin())
}
// https://github.com/rollup/plugins/tree/master/packages/replace
rollupConfig.plugins.push(replace({