mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
Minimal fix for auto-importing node_modules in node12/nodenext (#46148)
This commit is contained in:
@@ -619,7 +619,7 @@ namespace ts.moduleSpecifiers {
|
||||
const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
|
||||
const packageName = getPackageNameFromTypesPackageName(nodeModulesDirectoryName);
|
||||
// For classic resolution, only allow importing from node_modules/@types, not other node_modules
|
||||
return getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs && packageName === nodeModulesDirectoryName ? undefined : packageName;
|
||||
return getEmitModuleResolutionKind(options) === ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
|
||||
|
||||
function tryDirectoryWithPackageJson(packageRootIndex: number) {
|
||||
const packageRootPath = path.substring(0, packageRootIndex);
|
||||
|
||||
Reference in New Issue
Block a user