antfu / esbuild-node-loader

Transpile TypeScript to ESM with Node.js loader.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unknown file extension ".tsx"

talentlessguy opened this issue · comments

commented

When trying to run node --loader=esbuild-node-loader index.test.tsx I get this error:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".tsx" for /home/v1rtl/Coding/use-onboard/tests/index.test.tsx

my tsconfig:

{
  "include": ["src"],
  "compilerOptions": {
    "module": "ESNext",
    "target": "ES2019",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "isolatedModules": true,
    "preserveSymlinks": true,
    "noEmit": true,
    "declaration": true,
    "declarationDir": "dist",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "jsx": "react",
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "noFallthroughCasesInSwitch": true
  },
  "exclude": ["node_modules"]
}

What's the use case of tsx in node?

commented

@antfu React SSR

SSR without bundling? 👀 Alright then, maybe you can give it a try with a PR? Thanks

commented

@antfu well I don't need the bundling part, I need this loader to be able to transpile JSX in TS files just like the regular esbuild

but thx I'll make a PR