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

Support nullish coalescing operator (??) #634

Closed
fabiospampinato opened this issue May 2, 2022 · 5 comments
Closed

Support nullish coalescing operator (??) #634

fabiospampinato opened this issue May 2, 2022 · 5 comments
Labels

Comments

@fabiospampinato
Copy link

fabiospampinato commented May 2, 2022

Describe the bug

If a module uses the null coalescing operator the whole build process seems to fail.

To Reproduce

Go here: https://bundlephobia.com/package/voby

Build error:

/tmp/tmp-build/packages/build-voby-VAi/node_modules/voby/dist/methods/create_context.js 16:43 Module parse failed: Unexpected token (16:43) File was processed with these loaders: * ./node_modules/shebang-loader/index.js * ./node_modules/string-replace-loader/index.js You may need an additional loader to handle the result of these loaders. | }; | const Consumer = ({ children }) => { > const value = oby.context(symbol) ?? defaultValue; | return children(value); | }; @ /tmp/tmp-build/packages/build-voby-VAi/node_modules/voby/dist/methods/index.js 4:0-48 14:0-118 @ /tmp/tmp-build/packages/build-voby-VAi/node_modules/voby/dist/index.js @ /tmp/tmp-build/packages/build-voby-VAi/index.js

Expected behavior

It should build properly. The null coalescing operator is supported in ~90% of browsers already.

@Valexr
Copy link

Valexr commented May 3, 2022

& Optional chaining too #606 🤓

@trash-and-fire
Copy link

If you want to support these operators, please mark such packages as incompatible with es6. I think such labels can save time on debugging and tweaking Babel to support older browsers. Not every project does a Babel transformation on their node_modules.

@LeaVerou
Copy link

Another vote for this, colorjs.io also fails: https://bundlephobia.com/package/colorjs.io

?? has been supported in Node since v14!

@fabiospampinato fabiospampinato changed the title Support null coalescing operator (??) Support nullish coalescing operator (??) Jun 29, 2022
@GRA0007
Copy link

GRA0007 commented Jul 2, 2022

This is a duplicate of #530

@pastelsky
Copy link
Owner

This works now after our new update —
https://bundlephobia.com/package/[email protected]
https://bundlephobia.com/package/[email protected]

Thanks for your patience! I know this was long overdue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants