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

Trying to use with React Typescript #6

Closed lyhourchhen closed 3 years ago

lyhourchhen commented 3 years ago
./src/index.tsx
Error: Argument at `2` is not JsBuffer

Caused by:
    unknown field `jsx`, expected one of `tsx`, `decorators`, `dynamicImport`, `importAssertions` at line 1 column 318
    at Generator.next (<anonymous>)
    at new Promise (<anonymous>)
pradel commented 3 years ago

What's your craco config?

lyhourchhen commented 3 years ago

I try to run directly from your example.

const cracoSwcPlugin = require('craco-swc');

module.exports = {
  plugins: [
    {
      plugin: cracoSwcPlugin,
    },
  ],
};
pradel commented 3 years ago

Do you have a .swcrc file? Also do you have a tsconfig.json file at the root of your repo?

lyhourchhen commented 3 years ago

The example is missing this .srwcrc now i am pull requesting.