File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
projects/igniteui-angular/migrations/common Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type { Tree } from '@angular-devkit/schematics';
22import * as pathFs from 'path' ;
33import * as ts from 'typescript/lib/tsserverlibrary' ;
44import { CUSTOM_TS_PLUGIN_NAME , CUSTOM_TS_PLUGIN_PATH } from './tsUtils' ;
5+ import { createRequire } from 'module' ;
56
67/**
78 * Language server host is responsible for **most** of the FS operations / checks
@@ -11,6 +12,8 @@ export class ServerHost implements ts.server.ServerHost {
1112 public readonly args : string [ ] ;
1213 public readonly newLine : string ;
1314 public readonly useCaseSensitiveFileNames : boolean ;
15+ /** Cached because Angular schematics encapsulation's customRequire doesn't provide `resolve` */
16+ private nativeRequire = createRequire ( __filename ) ;
1417
1518 constructor ( private host : Tree ) {
1619 this . args = ts . sys . args ;
@@ -126,7 +129,7 @@ export class ServerHost implements ts.server.ServerHost {
126129 moduleName = CUSTOM_TS_PLUGIN_PATH ;
127130 paths . push ( __dirname ) ;
128131 }
129- const modulePath = require . resolve ( moduleName , { paths } ) ;
132+ const modulePath = this . nativeRequire . resolve ( moduleName , { paths } ) ;
130133 return {
131134 module : require ( modulePath ) ,
132135 error : undefined ,
You can’t perform that action at this time.
0 commit comments