Skip to content

Commit ea989e1

Browse files
addaleaxcodebytere
authored andcommitted
worker: unroll file extension regexp
Refs: #31662 (comment) PR-URL: #31779 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent e6debf5 commit ea989e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Worker extends EventEmitter {
103103
filename = path.resolve(filename);
104104

105105
const ext = path.extname(filename);
106-
if (!/^\.[cm]?js$/.test(ext)) {
106+
if (ext !== '.js' && ext !== '.mjs' && ext !== '.cjs') {
107107
throw new ERR_WORKER_UNSUPPORTED_EXTENSION(ext);
108108
}
109109
}

0 commit comments

Comments
 (0)