Skip to content

Commit 7142c55

Browse files
authored
Support more JS extensions in syntax-parser (#10615)
1 parent b659cdb commit 7142c55

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/replay-next/src/utils/syntax-parser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,17 @@ function urlToLanguage(fileName: string): LRLanguage {
134134
const extension = fileName.split(".").pop()!.split("?").shift()!;
135135
switch (extension) {
136136
case "js":
137+
case "mjs":
138+
case "cjs":
137139
return javascriptLanguage;
138140
case "jsx":
139141
return jsxLanguage;
140142
case "ts":
141143
return typescriptLanguage;
142144
case "tsx":
145+
// .mts and .cts follow .tsx parsing rules (they don't support angle bracket casting and they allow JSX)
146+
case "mts":
147+
case "cts":
143148
return tsxLanguage;
144149
case "json":
145150
return jsonLanguage;

0 commit comments

Comments
 (0)