-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Webpack 4 can not run code with Optional Chaining Operator #518
Comments
Hello! Hmm, but chaining operator was in code since version 3.0.0, for instance here air-datepicker/src/datepickerCell.js Line 114 in 01b639b
Usually you should set webpack to ignore |
Thank you for your answer, I looked into older versions and saw that indeed such optional chaining operators already existed in the source code, but the essence of the problem does not change much, because they were not in the compiled code For your provided example, the compiled code in
But compiled example in
And, unfortunately, I can not ignore |
Hmmm, strange... I think its because of my different dev environments. Will try to fix this on next week |
Added optional chaining operator handling in v3.3.5 |
Hello, my application uses your wonderful package, but recently I ran into a problem: when updating dependencies and trying to run the application, I get an error from
babel-loader
pointing to theair-datepicker.js
file.Error description:
Since version
3.3.3
, optional chaining operators (?.) appeared in your package code, which are successfully supported by all modern browsers, but, unfortunately, are not supported by the Webpack 4 (React/CRA 4) builder. And, unfortunately, it will be quite difficult for me to fix this problem, so I ask you to fix this nuance with yours.On the Internet, I found one fairly simple way to solve this problem: use the
@babel/plugin-proposal-optional-chaining
plugin for babel (https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining), it will transpile these operators into ternary expressions, no code changes are required.P.S. also Webpack 4 has a problem with
nullish coalescing operator
in packages, there is also a plugin for it: https://babeljs.io/docs/en/babel-plugin-proposal-nullish-coalescing-operatorThe text was updated successfully, but these errors were encountered: