Closed prbxr closed 4 years ago
Nullish Coalescing and Optional Chaining should work right out of the box. You don't need to configure babel with custom loaders.
That being said, I cannot break the CLI (or those features) with the config you've offered, so your issue is likely some other configuration you've done on top of this. Can you provide a repo?
I run preact create typescript It creates .babelrc with preact/cli preset I added such a file to my project And now it works fine
The doc said that putting such a file will override the original config, so I tried to config babel inside preact.config. But that didn't work
The doc said that putting such a file will override the original config, so I tried to config babel inside preact.config.
What it says is:
You may create a .babelrc file in your project's root directory. Any settings you define here will overwrite matching config-keys within Preact CLI preset. For example, if you pass a "plugins" object, it will replace & reset all Babel plugins that Preact CLI defaults to.
So creating such a file is how you override parts of the original config, it doesn't replace the original entirely. The default .babelrc
that the template shipped with overwrote nothing as it didn't have any config-keys to match up against.
doesnt work for me. I am on latest preact & preact-cli
doesnt work for me. I am on latest preact & preact-cli
Are you on preact-cli v4?
@rschristian I mean latest stable version - 3.5.1
I can all but guarantee you're running into #1747.
Preact-CLI is not maintained, and as such, I'm not going to mark v4 as "stable", but you absolutely should be using it. Webpack 4 is quite old and you'll see more and more of these issues until you switch.
If preact-CLI isn't maintained, what is way to setup a preact app going forward?
Upgraded to preact-CLI 4 and that fixed the mentioned problem! Thanks a lot @rschristian For anyone wanting to upgrade, here is the PR for more info - https://github.com/preactjs/preact-cli/pull/1807
I wish someday I'll be able to use Vite to setup my app :)
preact-cli 3.03
question / feature request
How to add optional chaining while using typescript?
I am using the default babel-loader config
Added this preact.config.js
but this is the result: