Skip to content

JSX Transform Issues #562

@austinm911

Description

@austinm911

Reproduction link or steps

Was having issues transforming react code.

"tsdown": "^0.15.4",

Config

import { defineConfig } from 'tsdown'

export default defineConfig({
	entry: [
		'src/index.ts',
		'src/map/**/*',
		'!src/**/*.stories.{ts,tsx}',
		'!src/**/*.test.{ts,tsx}',
	],
	dts: true,
	clean: true,
	sourcemap: true,
	minify: false,
	target: 'es2022',
	outDir: 'dist',
	exports: true,
	inputOptions: {
		transform: {
			jsx: 'react-jsx',
		},
	},
})

jsx?: false | "react" | "react-jsx" | "preserve" | JsxOptions; is the type of inputOptions.transform.jsx but this error will throw

Warning: Invalid input options (1 issue found)
- For the "transform.jsx". Invalid type: Expected ("preserve" | Object) but received "react-jsx". 

Second, if you have preserve in tsconfig, but react-jsx in inputOptions.transform.jsx, tsconfig will override the tsdown config setting for jsx, which I don't believe in intended behavior

I set tsconfig and tsdown settings to both react-jsx.

What is expected?

Transforms correctly.

What is actually happening?

see above

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstream

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions