pradel / create-react-app-swc

Use swc in your create-react-app for faster compilation, development and tests
MIT License
129 stars 11 forks source link

Optional chaining not working #4

Closed amorriscode closed 2 years ago

amorriscode commented 3 years ago

Hey all! 👋

I'm getting errors because of optional chaining:

../common/store/users/in-flight-activity-slice.js 12:37
Module parse failed: Unexpected token (12:37)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|   reducers: {
|     addInFlightActivity: (state, action) => {
>       const addedId = action.payload?.id;
|

Here's my .swcrc file.

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": true,
      "dynamicImport": true,
      "exportDefaultFrom": true,
      "decorators": true,
      "decoratorsBeforeExport": true
    },
    "transform": {
      "legacyDecorator": true
    },
    "target": "es5",
    "externalHelpers": true
  }
}

It seems swc should have no problem with optional chaining but haven't had any success here. 😄

pradel commented 3 years ago

Can you retry with the latest version published 0.1.3?