From ff71180d18fc07dcac8a2e581d321326e46c1825 Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Wed, 13 Feb 2019 16:33:36 +0200 Subject: [PATCH] webpack-loader: revert plugging-in webpack's fs to the service it appears the inputFileSystem is not up to date on watch events, even though webpack passes in the "new" source to the loader. should fix watch mode issues. --- .../webpack-loader/src/typescript-loader.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/packages/webpack-loader/src/typescript-loader.ts b/packages/webpack-loader/src/typescript-loader.ts index a4c87fcd..908769b7 100755 --- a/packages/webpack-loader/src/typescript-loader.ts +++ b/packages/webpack-loader/src/typescript-loader.ts @@ -1,4 +1,3 @@ -import { dirname, join, normalize } from 'path' import ts from 'typescript' import { TypeScriptService, ITranspilationOptions } from '@ts-tools/service' import { resolvedModulesTransformer } from '@ts-tools/robotrix' @@ -9,8 +8,6 @@ const { sys } = ts const externalSourceMapPrefix = `//# sourceMappingURL=` const platformHasColors = !!sys && !!sys.writeOutputIsTTY && sys.writeOutputIsTTY() -const defaultLibsDirectory = dirname(ts.getDefaultLibFilePath({})) - /** * Loader options which can be provided via webpack configuration * or a specific request query string @@ -109,20 +106,7 @@ export const typescriptLoader: loader.Loader = function(/* source */) { tsconfigFileName: loaderOptions.tsconfigFileName, getCustomTransformers(_baseHost, compilerOptions) { return compilerOptions && compilerOptions.baseUrl ? { after: [resolvedModulesTransformer] } : undefined - }, - getCustomFs: () => ({ - // normalize paths because typescript uses linux-like path representation in Windows - // while webpack uses native paths - readFileSync: (path, encoding = 'utf8') => this.fs.readFileSync(normalize(path)).toString(encoding), - statSync: path => this.fs.statSync(normalize(path)), - readdirSync: path => this.fs.readdirSync(normalize(path)), - realpathSync: sys && sys.realpath, - dirname, - join, - normalize, - defaultLibsDirectory, - caseSensitive: !!sys && sys.useCaseSensitiveFileNames - }) + } } // transpile using `this.resourcePath`, ignoring the `source` provided to loader.