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 }