-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix(babel-preset-app): always transpile optional chaining and nullish-coalescing for server #8203
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding this plugin in babel-preset-app only for server env would be better.
@clarkdo Indeed but as mentioned i tried this: (on an external project) This doesn't works (probably preset-env somehow takes over?) And what do you think about fixing target to 10 or 12? |
@pi0 What about add it in include: ['proposal-optional-chaining'] |
@clarkdo Actually it was babel cache that needed to be manually invalidated 🙈 Seems all fine now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
I'm running nuxt 2.14.7 now (with node 15.1.0, yarn 1.2.10), but I'm still getting a fatal error when I try to use a nullish coalescing operator or optional chaining in a generate function in my nuxt.config.js:
Is this expected behavior? Am I making a mistake somewhere? Should I open a new issue? |
Types of changes
Description
Since node@14 supports optional chaining,
@babel/preset-env
disables transpilation for this target (we use runtime node version as target). But this makes troubles (#7722) as webpack@4 uses acorn 6.x which doesn't support this syntax (webpack/webpack#10227)Alternative
We could strictly set node target to 8 or 10 to avoid same happening in the future with acorn and nuxt@2
Checklist: