@@ -125,10 +125,10 @@ const { pathToFileURL, fileURLToPath, isURL } = require('internal/url');
125125const {
126126 pendingDeprecate,
127127 emitExperimentalWarning,
128- isUnderNodeModules,
129128 kEmptyObject,
130129 setOwnProperty,
131130 getLazy,
131+ isUnderNodeModules,
132132 isWindows,
133133} = require ( 'internal/util' ) ;
134134const {
@@ -170,7 +170,6 @@ const {
170170 ERR_REQUIRE_CYCLE_MODULE ,
171171 ERR_REQUIRE_ESM ,
172172 ERR_UNKNOWN_BUILTIN_MODULE ,
173- ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ,
174173 } ,
175174 setArrowMessage,
176175} = require ( 'internal/errors' ) ;
@@ -1348,9 +1347,6 @@ let emittedRequireModuleWarning = false;
13481347function loadESMFromCJS ( mod , filename ) {
13491348 let source = getMaybeCachedSource ( mod , filename ) ;
13501349 if ( getOptionValue ( '--experimental-strip-types' ) && path . extname ( filename ) === '.mts' ) {
1351- if ( isUnderNodeModules ( filename ) ) {
1352- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1353- }
13541350 source = stripTypeScriptTypes ( source , filename ) ;
13551351 }
13561352 const cascadedLoader = require ( 'internal/modules/esm/loader' ) . getOrInitializeCascadedLoader ( ) ;
@@ -1587,9 +1583,6 @@ function getMaybeCachedSource(mod, filename) {
15871583}
15881584
15891585function loadCTS ( module , filename ) {
1590- if ( isUnderNodeModules ( filename ) ) {
1591- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1592- }
15931586 const source = getMaybeCachedSource ( module , filename ) ;
15941587 const code = stripTypeScriptTypes ( source , filename ) ;
15951588 module . _compile ( code , filename , 'commonjs' ) ;
@@ -1601,9 +1594,6 @@ function loadCTS(module, filename) {
16011594 * @param {string } filename The file path of the module
16021595 */
16031596function loadTS ( module , filename ) {
1604- if ( isUnderNodeModules ( filename ) ) {
1605- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1606- }
16071597 // If already analyzed the source, then it will be cached.
16081598 const source = getMaybeCachedSource ( module , filename ) ;
16091599 const content = stripTypeScriptTypes ( source , filename ) ;
0 commit comments