Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit b511d7e

Browse files
committed
program in customtransformers path
1 parent 27e55e2 commit b511d7e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/checker/runtime.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
8282
let ignoreDiagnostics: {[id: number]: boolean} = {};
8383
let instanceName: string;
8484
let context: string;
85-
let getCustomTransformers: ()=>ts.CustomTransformers | undefined;
8685

8786
function ensureFile(fileName: string) {
8887
if (!files[fileName]) {
@@ -137,7 +136,6 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
137136

138137
class Host implements ts.LanguageServiceHost {
139138
filesRegex: RegExp;
140-
getCustomTransformers=getCustomTransformers;
141139

142140
constructor(filesRegex: RegExp) {
143141
this.filesRegex = filesRegex;
@@ -240,10 +238,6 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
240238
compilerInfo = payload.compilerInfo;
241239
loaderConfig = payload.loaderConfig;
242240

243-
if (loaderConfig.customTranformersPath !== undefined) {
244-
getCustomTransformers = require(loaderConfig.customTranformersPath)
245-
}
246-
247241
compilerConfig = payload.compilerConfig;
248242
compilerOptions = compilerConfig.options;
249243
webpackOptions = payload.webpackOptions;
@@ -268,8 +262,12 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
268262
};
269263
});
270264

271-
272265
const program = service.getProgram();
266+
267+
if (loaderConfig.customTranformersPath !== undefined) {
268+
host.getCustomTransformers = require(loaderConfig.customTranformersPath)(program);
269+
}
270+
273271
program.getSourceFiles().forEach(file => {
274272
files[file.fileName] = {
275273
text: file.text,

0 commit comments

Comments
 (0)