Skip to content

Commit a221f9b

Browse files
committed
fix: do not wrongfully match application/javascript mime
Fixes: nodejs#48957
1 parent b68e5e7 commit a221f9b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/internal/modules/esm/formats.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ if (experimentalWasmModules) {
2424
* @returns {string | null}
2525
*/
2626
function mimeToFormat(mime) {
27-
if (
28-
RegExpPrototypeExec(
29-
/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i,
30-
mime,
31-
) !== null
32-
) return 'module';
27+
if (mime === 'text/javascript') return 'module';
3328
if (mime === 'application/json') return 'json';
3429
if (experimentalWasmModules && mime === 'application/wasm') return 'wasm';
3530
return null;

0 commit comments

Comments
 (0)