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

Ensure optional chaining in swc matches babel #33995

Merged
merged 2 commits into from Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/next/build/swc/options.js
Expand Up @@ -117,6 +117,13 @@ export function getJestSWCOptions({
// Targets the current version of Node.js
node: process.versions.node,
},
// we always transpile optional chaining and nullish coalescing
// since it can cause issues with webpack even if the node target
// supports them
include: [
'proposal-optional-chaining',
'proposal-nullish-coalescing-operator',
],
},
module: {
type: esm && !isNextDist ? 'es6' : 'commonjs',
Expand Down Expand Up @@ -165,6 +172,13 @@ export function getLoaderSWCOptions({
// Targets the current version of Node.js
node: process.versions.node,
},
// we always transpile optional chaining and nullish coalescing
// since it can cause issues with webpack even if the node target
// supports them
include: [
'proposal-optional-chaining',
'proposal-nullish-coalescing-operator',
],
},
}
} else {
Expand Down
4 changes: 4 additions & 0 deletions test/integration/production/pages/about.js
@@ -1 +1,5 @@
import info from '../info.json'

console.log('info:', info?.something?.nested)

export default () => <div className="about-page">About Page</div>