Skip to content

Commit 95eea30

Browse files
committed
don't rewrite explicit .cjs/.mjs extensions
1 parent 6181ea6 commit 95eea30

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tsc-multi",
3-
"version": "1.1.8",
3+
"version": "1.1.9",
44
"description": "Compile multiple TypeScript projects into multiple targets.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/transformer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { trimSuffix } from "./utils";
44
import assert from "assert";
55

66
const JS_EXT = ".js";
7+
const MJS_EXT = ".mjs";
8+
const CJS_EXT = ".cjs";
79
const JSON_EXT = ".json";
810

911
function isRelativePath(path: string): boolean {
@@ -70,6 +72,10 @@ export function createTransformer<T extends ts.SourceFile | ts.Bundle>(
7072

7173
const ext = extname(node.text);
7274

75+
if (ext === MJS_EXT || ext === CJS_EXT) {
76+
return node;
77+
}
78+
7379
if (ext === JSON_EXT && ctx.getCompilerOptions().resolveJsonModule) {
7480
return node;
7581
}

tsc-multi-1.1.7.tgz

-31.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)