codesandbox / codesandbox-client

An online IDE for rapid web development
https://codesandbox.io
Other
12.97k stars 2.26k forks source link

The nullish coalescing operator doesn't work in a vanilla JavaScript sandbox #8160

Open rainyEra opened 8 months ago

rainyEra commented 8 months ago

🐛 bug report

Preflight Checklist

Description of the problem

Nullish coalescing operator doesn't works in JS vanilla sandbox

How has this issue affected you? What are you trying to accomplish?

I tried to count letters ;p

To Reproduce

https://codesandbox.io/s/holy-framework-dfwmlh?file=/src/index.mjs

Your Environment

Software Name/Version
Сodesandbox Client(?), not cloud
Browser Chrome Version 118.0.5993.90 (Official Build) (64-bit)
Operating System Windows 10 Pro Build 19045.3570 Windows Feature Experience Pack 1000.19052.1000.0
DevJoaoLopes commented 7 months ago

Hello @rainyEra

I believe the problem is caused by the Babel transpilation, since package @babel/plugin-proposal-nullish-coalescing-operator is no longer being used.

However, creating vanilla codes from the new version of codesandbox we no longer have this problem, as @babel/preset-env@babel/preset-env is being used, which already has this native functionality in ECMAScript.

rainyEra commented 7 months ago

Hello @rainyEra

I believe the problem is caused by the Babel transpilation, since package @babel/plugin-proposal-nullish-coalescing-operator is no longer being used.

However, creating vanilla codes from the new version of codesandbox we no longer have this problem, as @babel/preset-env@babel/preset-env is being used, which already has this native functionality in ECMAScript.

Cool!