@@ -125,10 +125,10 @@ const { pathToFileURL, fileURLToPath, isURL } = require('internal/url');
125
125
const {
126
126
pendingDeprecate,
127
127
emitExperimentalWarning,
128
- isUnderNodeModules,
129
128
kEmptyObject,
130
129
setOwnProperty,
131
130
getLazy,
131
+ isUnderNodeModules,
132
132
isWindows,
133
133
} = require ( 'internal/util' ) ;
134
134
const {
@@ -170,7 +170,6 @@ const {
170
170
ERR_REQUIRE_CYCLE_MODULE ,
171
171
ERR_REQUIRE_ESM ,
172
172
ERR_UNKNOWN_BUILTIN_MODULE ,
173
- ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ,
174
173
} ,
175
174
setArrowMessage,
176
175
} = require ( 'internal/errors' ) ;
@@ -1348,9 +1347,6 @@ let emittedRequireModuleWarning = false;
1348
1347
function loadESMFromCJS ( mod , filename ) {
1349
1348
let source = getMaybeCachedSource ( mod , filename ) ;
1350
1349
if ( getOptionValue ( '--experimental-strip-types' ) && path . extname ( filename ) === '.mts' ) {
1351
- if ( isUnderNodeModules ( filename ) ) {
1352
- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1353
- }
1354
1350
source = stripTypeScriptTypes ( source , filename ) ;
1355
1351
}
1356
1352
const cascadedLoader = require ( 'internal/modules/esm/loader' ) . getOrInitializeCascadedLoader ( ) ;
@@ -1587,9 +1583,6 @@ function getMaybeCachedSource(mod, filename) {
1587
1583
}
1588
1584
1589
1585
function loadCTS ( module , filename ) {
1590
- if ( isUnderNodeModules ( filename ) ) {
1591
- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1592
- }
1593
1586
const source = getMaybeCachedSource ( module , filename ) ;
1594
1587
const code = stripTypeScriptTypes ( source , filename ) ;
1595
1588
module . _compile ( code , filename , 'commonjs' ) ;
@@ -1601,9 +1594,6 @@ function loadCTS(module, filename) {
1601
1594
* @param {string } filename The file path of the module
1602
1595
*/
1603
1596
function loadTS ( module , filename ) {
1604
- if ( isUnderNodeModules ( filename ) ) {
1605
- throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING ( filename ) ;
1606
- }
1607
1597
// If already analyzed the source, then it will be cached.
1608
1598
const source = getMaybeCachedSource ( module , filename ) ;
1609
1599
const content = stripTypeScriptTypes ( source , filename ) ;
0 commit comments