From 6acfdcd0f7182f0b316730a8e1f5618cc2674491 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 14 Oct 2021 19:57:23 +0100 Subject: [PATCH] refactor(nitro): move wasm support behind a flag (`nitro.experiments.wasm`) (#1045) --- packages/nitro/src/context.ts | 4 ++++ packages/nitro/src/rollup/config.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nitro/src/context.ts b/packages/nitro/src/context.ts index f9e51c89e8..7367c064a7 100644 --- a/packages/nitro/src/context.ts +++ b/packages/nitro/src/context.ts @@ -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, diff --git a/packages/nitro/src/rollup/config.ts b/packages/nitro/src/rollup/config.ts index fa65fd4b2b..ea2af86765 100644 --- a/packages/nitro/src/rollup/config.ts +++ b/packages/nitro/src/rollup/config.ts @@ -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({