Skip to content

Commit e208e3b

Browse files
Update loader.js
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 519235b commit e208e3b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/internal/modules/cjs/loader.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,9 +1932,8 @@ Module._extensions['.js'] = function(module, filename) {
19321932
format = 'typescript';
19331933
}
19341934
} else if (path.extname(filename) === '') {
1935-
// Extensionless files skip the .js suffix check above. When type is commonjs,
1936-
// follow it so ESM syntax surfaces as SyntaxError instead of silently
1937-
// delegating to ESM. For type: module, leave format undefined so our syntax
1935+
// Extensionless files skip the .js suffix check above. When type is commonjs, follow it so ESM
1936+
// syntax surfaces as SyntaxError. For type: module, leave format undefined so our syntax
19381937
// detection handles it (allowing CJS extensionless files in ESM packages).
19391938
pkg = packageJsonReader.getNearestParentPackageJSON(filename);
19401939
const typeFromPjson = pkg?.data?.type;

0 commit comments

Comments
 (0)