File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -318,8 +318,6 @@ class ModuleLoader {
318318 * @returns {ModuleJobBase }
319319 */
320320 getModuleJobForRequire ( specifier , parentURL , importAttributes ) {
321- assert ( getOptionValue ( '--experimental-require-module' ) ) ;
322-
323321 const parsed = URLParse ( specifier ) ;
324322 if ( parsed != null ) {
325323 const protocol = parsed . protocol ;
@@ -338,6 +336,9 @@ class ModuleLoader {
338336 }
339337
340338 const { url, format } = resolveResult ;
339+ if ( ! getOptionValue ( '--experimental-require-module' ) ) {
340+ throw new ERR_REQUIRE_ESM ( url , true ) ;
341+ }
341342 const resolvedImportAttributes = resolveResult . importAttributes ?? importAttributes ;
342343 let job = this . loadCache . get ( url , resolvedImportAttributes . type ) ;
343344 if ( job !== undefined ) {
You can’t perform that action at this time.
0 commit comments