From c0b50071497125ddd5531e4922d83c389b05b729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Barr=C3=A9?= Date: Mon, 30 Oct 2023 13:47:48 +0100 Subject: [PATCH] feat: add support for `.mts` (fixes #161) (#166) --- CHANGELOG.md | 2 ++ src/index.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95117e0..9d2a0fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Add support for `.mts` (fixes [#161](https://github.com/vitejs/vite-plugin-react-swc/issues/161)) + ## 3.4.0 - Add `devTarget` option (fixes [#141](https://github.com/vitejs/vite-plugin-react-swc/issues/141)) diff --git a/src/index.ts b/src/index.ts index 55c49d2..5a5f851 100644 --- a/src/index.ts +++ b/src/index.ts @@ -205,7 +205,7 @@ const transformWithOptions = async ( const decorators = options?.tsDecorators ?? false; const parser: ParserConfig | undefined = id.endsWith(".tsx") ? { syntax: "typescript", tsx: true, decorators } - : id.endsWith(".ts") + : id.endsWith(".ts") || id.endsWith(".mts") ? { syntax: "typescript", tsx: false, decorators } : id.endsWith(".jsx") ? { syntax: "ecmascript", jsx: true }