Skip to content

Commit

Permalink
tsconfig jsx cannot be preserve
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Feb 10, 2023
1 parent d953536 commit 1134216
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,15 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
;[imports, exports] = parseImports(source)
} catch (e: any) {
const isVue = importer.endsWith('.vue')
const isJsx = importer.endsWith('.jsx') || importer.endsWith('.tsx')
const maybeJSX = !isVue && isJSRequest(importer)

const msg = isVue
? `Install @vitejs/plugin-vue to handle .vue files.`
: maybeJSX
? `If you are using JSX, make sure to name the file with the .jsx or .tsx extension.`
? isJsx
? `If you use tsconfig.json, make sure don't set jsx to preserve.`
: `If you are using JSX, make sure to name the file with the .jsx or .tsx extension.`
: `You may need to install appropriate plugins to handle the ${path.extname(
importer,
)} file format, or if it's an asset, add "**/*${path.extname(
Expand Down

0 comments on commit 1134216

Please sign in to comment.