-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fixed webpack 4 builds breaking due to nullish coalescing operator #3679
Fixed webpack 4 builds breaking due to nullish coalescing operator #3679
Conversation
… in order to fix webpack 4 builds
This seems improper. Nullish coalescing is basically from the same time that Alpines minimum features are from. If you haven't updated Webpack in 3 years, then why would you need to update Alpine now? The CDN version is already transpiled to target ES 2017 if you need that. |
Thanks for your thoughts. I agree we're quite late with the webpack update. But I'd say outdated build tools are not a super uncommon thing, aren't they? We're trying to keep at least the code we ship to users up to date, so updating Alpine is definitely a priority. |
Don't you just need to use https://babeljs.io/docs/babel-plugin-transform-nullish-coalescing-operator in your build process? |
@SimoTod Sure, that works. But my proposal is fixing it on the library side so people don't need a transpiler to be able to use the library. Feel free to reject if this is not a priority for you, we'll be fine without the change! |
No worries, I wasn't sure you were aware of the option. I don't have decisional power, the maintainer will review and decide. |
Hi everyone, maybe we can still persuade the developers to replace 'nullish coalescing operator' with es5 format? :) it's just the only issue that makes AlpineJS not work on ios 12-13.. a simple format change will cover these two versions, this is very important |
The CDN already transpiles this, and you can set your own bundling target (and should be). nullish coalescing is transpilable, so it's better to set up your tooling for the goals you have than to hold the rest of the crabs in the bucket. |
Because there are so few instances of "??" I'm going to merge this, but I agree we should be able to use these syntaxes and may in the future. Thanks. everyone |
What's the issue?
After upgrading to the latest version of
alpinejs
in a webpack 4 project, I discovered that my build was broken due to webpack encountering the unexpected token??
in Alpine's source. This is the nullish coalescing operator and it was introduced inalpinejs@3.12.1
(#3483). It's fairly common nowadays. It wasn't though when webpack 4 was a thing, and it turned out webpack 4 never got support for it. See this nice write-up of the same problem in a completely unrelated project: PaulLeCam/react-leaflet#883Proposal
The problem could be solved on the consumer side by adding transpilation for
??
. I'd still suggest fixing it on the library side for the following reasons:??
can easily be replaced and we get extended webpack 4 support with virtually no effortWhat do you guys think?