-
Notifications
You must be signed in to change notification settings - Fork 363
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
TypeScript 3.7.x: Optional chaining and nullish coalescing is broken #522
Comments
I spoke too soon. After digging a little deeper, it seems the issue is actually related to TypeScript emitting optional chaining and nullish coalescing without transpilation with I updated the title to reflect this new information. |
Microbundle doesn't do anything special, it uses the typescript plugin which is responsible for handling that.
And Babel is forced with |
You can add a custom babelrc (the first babel plugin is for constants) |
I figured out from reading the source that a custom |
I came to the same conclusion. Shame, it was my first shot on this lib. It's a pity it does not merge babel settings or at least, allow you to customize it or append plugins. Anyway, this should be a top priority because as for today, the statement: Typescript supported, it's not true. Will keep an eye here for the fix. And if the fix is already there in the new version, why not publish it? @developit |
@smithki I'd assume you already are on the next version, because we didn't have babel in 0.11.0 It should work if you add a {
"plugins": [
[
"@babel/plugin-proposal-optional-chaining"
]
]
}
|
@ForsakenHarmony yeah, I've managed to get what I need in |
adding |
I mentioned that in my commment |
Doing the above worked for me in the newly released v0.12.0. |
This bug haven't been fixed in version
|
Just leaving this here in case some of you have issues with the compression of typescript.
"scripts": {
"dev": "microbundle",
"prod": "microbundle --compress",
"watch": "microbundle watch"
},
{
"plugins": [
"@babel/plugin-transform-typescript",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-object-rest-spread"
]
} |
@ConsoleTVs I got a new error
with configuration of {
"plugins": [
[
"@babel/plugin-transform-typescript",
"@babel/plugin-proposal-optional-chaining"
]
]
} |
My example is located here: https://github.com/Chartisan/Chartjs inside the |
@TechQuery you have an error in the config, it should be:
or
|
@lukas-valenta I sorry for one more {
"plugins": [
"@babel/plugin-transform-typescript",
"@babel/plugin-proposal-optional-chaining"
]
} |
dude I commented here for a reason. You need those 4:
|
@ConsoleTVs I find the reason isn't the 2 more plugins, just because |
I am running Microbundle v0.12.3 and this solution worked for me. |
The latest version of TypeScript (
3.7.x
) is broken if using optional chaining and nullish coalescing. It fails with the following error:The simple fix (I think) is to update the TypeScript dependency in
microbundle
. However... my preference would be formicrobundle
to detect if I have another version of TypeScript already registered in mypackage.json
and use that version as the default (falling back to the included dependency if required).The text was updated successfully, but these errors were encountered: