-
Notifications
You must be signed in to change notification settings - Fork 103
Closed
Description
Describe the bug
I'm trying to use DTS with Vite for React 5.3.1
In this version Vite introduced tsconfig.app.json and reference it in tsconfig.json:
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
}
For some reason, the tsconfig.app.json is not being recognized by DTS. I get the following error:

or
Module './App.tsx' was resolved to 'libray-ui/src/App.tsx', but '--jsx' is not set.

The solution that I'm using is add Edit: This solution doesn't work properlytsconfigPath: "./tsconfig.app.json", Is this a good solution?
plugins: [
react(),
dts({
tsconfigPath: "./tsconfig.app.json"
}),
],
Reproduction
https://stackblitz.com/edit/vitejs-vite-yxnnz2?file=vite.config.ts
Steps to reproduce
-
Run:
npm create vite@latest
npm install @types/node
npm install --save-dev vite-plugin-dts -
vite.config.ts
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import { resolve } from "path";
import dts from "vite-plugin-dts";
export default defineConfig({
plugins: [
react(),
dts(),
],
build: {
lib: {
entry: resolve(__dirname, "src/main.ts"),
name: "trigger-ui",
formats: ["es"],
fileName: "trigger-ui",
},
rollupOptions: {
external: ["react", "react/jsx-runtime"],
},
},
});
- main.tsx file
export const Card = ({ children, ...props }: CardTypes) => {
return <button {...props}>{children}</button>;
};
type CardTypes = {
children: string;
} & React.ComponentPropsWithoutRef<"button">;
- Run
npm run build
System Info
System:
OS: Windows 11
Binaries:
Node: 20.11.1
npm: 10.2.4
npmPackages:
@vitejs/plugin-react: ^4.3.1 => 4.3.1
vite: ^5.3.1 => 5.3.1
vite-plugin-dts: ^3.9.1 => 3.9.1Validations
- Read the FAQ.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels