build(broccoli-typescript): add support for moduleResolution=node
Closes #4779
This commit is contained in:
parent
b09788993d
commit
2c98a0f771
|
@ -223,10 +223,17 @@ class CustomLanguageServiceHost implements ts.LanguageServiceHost {
|
||||||
* not worth the potential issues with stale cache records.
|
* not worth the potential issues with stale cache records.
|
||||||
*/
|
*/
|
||||||
getScriptSnapshot(tsFilePath: string): ts.IScriptSnapshot {
|
getScriptSnapshot(tsFilePath: string): ts.IScriptSnapshot {
|
||||||
let absoluteTsFilePath =
|
let absoluteTsFilePath;
|
||||||
(tsFilePath == this.defaultLibFilePath || path.isAbsolute(tsFilePath)) ?
|
|
||||||
tsFilePath :
|
if (tsFilePath == this.defaultLibFilePath || path.isAbsolute(tsFilePath)) {
|
||||||
path.join(this.treeInputPath, tsFilePath);
|
absoluteTsFilePath = tsFilePath;
|
||||||
|
} else if (this.compilerOptions.moduleResolution === ts.ModuleResolutionKind.NodeJs &&
|
||||||
|
tsFilePath.match(/^node_modules/)) {
|
||||||
|
absoluteTsFilePath = path.resolve(tsFilePath);
|
||||||
|
} else {
|
||||||
|
absoluteTsFilePath = path.join(this.treeInputPath, tsFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!fs.existsSync(absoluteTsFilePath)) {
|
if (!fs.existsSync(absoluteTsFilePath)) {
|
||||||
// TypeScript seems to request lots of bogus paths during import path lookup and resolution,
|
// TypeScript seems to request lots of bogus paths during import path lookup and resolution,
|
||||||
|
|
Loading…
Reference in New Issue