Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(next-swc): always set useWasmBinary based on config in loadBindings - fixes #62059 #67420

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/next/src/build/swc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
import type { PageExtensions } from '../page-extensions-type'
import type { __ApiPreviewProps } from '../../server/api-utils'
import { getReactCompilerLoader } from '../get-babel-loader-config'
import loadOptions from '../../server/config'
import { PHASE_INFO } from '../../shared/lib/constants'

const nextVersion = process.env.__NEXT_VERSION as string

Expand Down Expand Up @@ -194,6 +196,16 @@ export interface Binding {
export async function loadBindings(
useWasmBinary: boolean = false
): Promise<Binding> {
// If the experimental.useWasmBinary flag is set in next.config.js, forcibly set useWasmBinary to true.
// This is because we'd otherwise have to propagate the flag everywhere loadBindings is used.
// See https://github.com/vercel/next.js/issues/62059.
if (useWasmBinary === false) {
const options = await loadOptions(PHASE_INFO, '')
if (options?.experimental?.useWasmBinary !== undefined) {
useWasmBinary = options.experimental.useWasmBinary
}
}

// Increase Rust stack size as some npm packages being compiled need more than the default.
if (!process.env.RUST_MIN_STACK) {
process.env.RUST_MIN_STACK = '8388608'
Expand Down
Loading