Incompatibility due to the nullish coalescing operator
See original GitHub issueHi,
Thank you for the polyfill, it works in latest environments but when dealing with older node versions, babel versions… it may fail to compile due to 1 nullish coalescing operator.
https://github.com/kenchris/urlpattern-polyfill/blob/main/src/url-pattern.ts#L159
I get this kind of error:
const defaultPattern = `[^${escapeString(options.delimiter ?? "/#?")}]+?`;
^
SyntaxError: Unexpected token '?'
I browsed a lot of topics posted across years I saw like 4-5 fixes to solve this issue. But in my case, since I have a Babel project I just had to update to:
"core-js": "^3.22.8",
And in my babel.config.js
:
module.exports = {
presets: ['@babel/preset-env'],
};
In case you don’t have Babel and no easy way to add it you will have to investigate 😄 …
It’s not really an issue, much more something to help in case it happens to someone else (I spent hours on this to find the minimal settings to tweak to make it working).
Thank you,
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Nullish coalescing operator makes package incompatible with ...
In conclusion, this means that this package is currently not compatible with webpack 4 without additional configuration because it includes the ...
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 >Use of nullish coalescing javascript operator makes this ...
Problem/Motivation Use of nullish coalescing javascript operator makes this module incompatible with IE11 and old browser versions Steps to ...
Read more >Nullish coalescing javascript operator not working in edge
As I said, this works Chrome and Firefox but results in a syntax error in Edge. Any ideas what I'm doing wrong? MDN...
Read more >JavaScript Tips: Nullish Coalescing (??) - Mike Bifulco
JavaScript's Nullish Coalescing operator is two question mark characters next to one another ( ?? ). It takes a left-hand and right-hand operand ......
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 Free
Top 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
@kenchris @sneko Fair point. See #104
This is a minor change with little to no impact on maintenance, so if it helps someone, I am OK with it. If it had an impact on maintenance, I would probably feel different