diff options
Diffstat (limited to 'node_modules/ts-loader/dist/index.js')
-rw-r--r-- | node_modules/ts-loader/dist/index.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/node_modules/ts-loader/dist/index.js b/node_modules/ts-loader/dist/index.js index 335c1b190..7a1e59041 100644 --- a/node_modules/ts-loader/dist/index.js +++ b/node_modules/ts-loader/dist/index.js @@ -32,10 +32,13 @@ function loader(contents) { throw new Error("Typescript emitted no output for " + filePath + "." + additionalGuidance); } var _c = makeSourceMap(sourceMapText, outputText, filePath, contents, this), sourceMap = _c.sourceMap, output = _c.output; - // Make sure webpack is aware that even though the emitted JavaScript may be the same as - // a previously cached version the TypeScript may be different and therefore should be - // treated as new - this._module.meta.tsLoaderFileVersion = fileVersion; + // _module.meta is not available inside happypack + if (!options.happyPackMode) { + // Make sure webpack is aware that even though the emitted JavaScript may be the same as + // a previously cached version the TypeScript may be different and therefore should be + // treated as new + this._module.meta.tsLoaderFileVersion = fileVersion; + } callback(null, output, sourceMap); } /** @@ -65,10 +68,13 @@ function getLoaderOptions(loader) { compilerOptions: {}, appendTsSuffixTo: [], entryFileIsJs: false, + happyPackMode: false, }, configFileOptions, queryOptions); options.ignoreDiagnostics = utils.arrify(options.ignoreDiagnostics).map(Number); options.logLevel = options.logLevel.toUpperCase(); options.instance = instanceName; + // happypack can be used only together with transpileOnly mode + options.transpileOnly = options.happyPackMode ? true : options.transpileOnly; loaderOptionsCache[instanceName] = options; return options; } @@ -136,7 +142,10 @@ function getTranspilationEmit(filePath, contents, instance, loader) { reportDiagnostics: true, fileName: fileName, }), outputText = _a.outputText, sourceMapText = _a.sourceMapText, diagnostics = _a.diagnostics; - utils.registerWebpackErrors(loader._module.errors, utils.formatErrors(diagnostics, instance.loaderOptions, instance.compiler, { module: loader._module })); + // _module.errors is not available inside happypack - see https://github.com/TypeStrong/ts-loader/issues/336 + if (!instance.loaderOptions.happyPackMode) { + utils.registerWebpackErrors(loader._module.errors, utils.formatErrors(diagnostics, instance.loaderOptions, instance.compiler, { module: loader._module })); + } return { outputText: outputText, sourceMapText: sourceMapText }; } function makeSourceMap(sourceMapText, outputText, filePath, contents, loader) { |