diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 00df53e1e35..23b172d1cfe 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1079,6 +1079,12 @@ namespace ts.server { project, fileName => this.onConfigFileAddedForInferredProject(fileName)); + if (root.scriptKind === ScriptKind.JS || root.scriptKind === ScriptKind.JSX) { + const options = project.getCompilerOptions(); + options.maxNodeModuleJsDepth = 2; + project.setCompilerOptions(options); + } + project.updateGraph(); if (!useExistingProject) { diff --git a/src/server/project.ts b/src/server/project.ts index 2172b037d89..6085ee05159 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -169,13 +169,6 @@ namespace ts.server { this.compilerOptions.allowNonTsExtensions = true; } - if (this.projectKind === ProjectKind.Inferred) { - // Add default compiler options for inferred projects here - if (this.compilerOptions.maxNodeModuleJsDepth === undefined) { - this.compilerOptions.maxNodeModuleJsDepth = 2; - } - } - this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost = new LSHost(this.projectService.host, this, this.projectService.cancellationToken);