question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support nullish coalescing operator (??)

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
pastelskycommented, Jul 20, 2022

This works now after our new update — https://bundlephobia.com/package/voby@0.34.10 https://bundlephobia.com/package/colorjs.io@0.3.0

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

4reactions
trash-and-firecommented, May 17, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nullish coalescing operator (`??`) | Can I use... Support ...
"Can I use" provides up-to-date browser support tables for support of front-end web technologies ... JavaScript operator: Nullish coalescing operator ( ?? )....
Read more >
Nullish coalescing operator (??) - JavaScript - MDN Web Docs
The nullish coalescing (??) operator is a logical operator that returns its right-hand side operand when its left-hand side operand is null ...
Read more >
Nullish coalescing operator '??'
The nullish coalescing operator isn't anything completely new. It's just a nice syntax to get the first “defined” value of the two. We...
Read more >
How to check if browser supports Nullish coalescing ...
The code tested in Internet Explorer and works fine. NEW UPDATE: After suggestions and read a lot some articles about substituting eval() with ......
Read more >
JavaScript Nullish Coalescing Operator
The nullish coalescing operator ( ?? ) is a logical operator that accepts two values and returns the second value if the first...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found