@@ -124,7 +124,6 @@ const { pathToFileURL, fileURLToPath, isURL } = require('internal/url');
124
124
const {
125
125
pendingDeprecate,
126
126
emitExperimentalWarning,
127
- isUnderNodeModules,
128
127
kEmptyObject,
129
128
setOwnProperty,
130
129
getLazy,
@@ -170,7 +169,6 @@ const {
170
169
ERR_REQUIRE_CYCLE_MODULE ,
171
170
ERR_REQUIRE_ESM ,
172
171
ERR_UNKNOWN_BUILTIN_MODULE ,
173
- ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ,
174
172
} ,
175
173
setArrowMessage,
176
174
} = require ( 'internal/errors' ) ;
@@ -1370,9 +1368,6 @@ let hasPausedEntry = false;
1370
1368
function loadESMFromCJS ( mod , filename ) {
1371
1369
let source = getMaybeCachedSource ( mod , filename ) ;
1372
1370
if ( getOptionValue ( '--experimental-strip-types' ) && path . extname ( filename ) === '.mts' ) {
1373
- if ( isUnderNodeModules ( filename ) ) {
1374
- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1375
- }
1376
1371
source = stripTypeScriptTypes ( source , filename ) ;
1377
1372
}
1378
1373
const cascadedLoader = require ( 'internal/modules/esm/loader' ) . getOrInitializeCascadedLoader ( ) ;
@@ -1594,9 +1589,6 @@ function getMaybeCachedSource(mod, filename) {
1594
1589
}
1595
1590
1596
1591
function loadCTS ( module , filename ) {
1597
- if ( isUnderNodeModules ( filename ) ) {
1598
- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1599
- }
1600
1592
const source = getMaybeCachedSource ( module , filename ) ;
1601
1593
const code = stripTypeScriptTypes ( source , filename ) ;
1602
1594
module . _compile ( code , filename , 'commonjs' ) ;
@@ -1608,9 +1600,6 @@ function loadCTS(module, filename) {
1608
1600
* @param {string } filename The file path of the module
1609
1601
*/
1610
1602
function loadTS ( module , filename ) {
1611
- if ( isUnderNodeModules ( filename ) ) {
1612
- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1613
- }
1614
1603
// If already analyzed the source, then it will be cached.
1615
1604
const source = getMaybeCachedSource ( module , filename ) ;
1616
1605
const content = stripTypeScriptTypes ( source , filename ) ;
0 commit comments