Skip to content

Nullish operator transpilation  #30389

Closed
@mr47

Description

@mr47

What version of Next.js are you using?

12

What version of Node.js are you using?

16

What browser are you using?

chrome

What operating system are you using?

macOS

How are you deploying your application?

vercel/netlify

Describe the Bug

Nullish operator breaks pages, for example

const test = my_array?.[0] ?? [];

will produce

(my_array === null || my_array === void 0 ? void 0 : my_array[0]) ?? [];

Expected Behavior

It should replace with || or what webpack / swc think is better

To Reproduce

Some api with

const test = my_array?.[0] ?? '';

next.config.js

experimental: {
    concurrentFeatures: false,
    serverComponents: false,
    swcMinify: false
}

next build

Metadata

Metadata

Assignees

Labels

SWCRelated to minification/transpilation in Next.js.bugIssue was opened via the bug report template.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions