Support nullish coalescing operator (??)
See original GitHub issueDescribe 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:
- Created a year ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.