aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ts-loader/dist/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-24 15:10:37 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-24 15:11:17 +0200
commit7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch)
tree70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/ts-loader/dist/index.js
parentaca1143cb9eed16cf37f04e475e4257418dd18ac (diff)
fix build issues and add typedoc
Diffstat (limited to 'node_modules/ts-loader/dist/index.js')
-rw-r--r--node_modules/ts-loader/dist/index.js19
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) {