Repository navigation
multiple instances, errors only shown of single instance #268
Description
Hy
I'm working on a project that targets node and the browser (using web workers). The project consists of a code base that is shared between node and the browser, and other parts that are browser, node or even web worker specific. To benefit the most from type script, multiple type script instances should be used with different libraries included (only es5, es5+dom, es5+web worker...).
Setup
I created a sample project with a similar structure in DatenMetzgerX/ts-loader-multiple-instances. Files located in src/common are es5 only and can be used by node or in the browser. At the other hand, files located in src/browser are specific for the browser environment. Different tsconfig.json files are used for each directory to configure the different libraries (es only, es + dom...). In each directory (common and browser) a single file is located that contains some trivial typescript errors (browser-defaults: a is a string, but a number is assigned, simple.js: n is a number, but a string is assigned).
The webpack configuration contains 2 configured ts-loader instances pointing todifferent tsconfig.json's and are distinguished by their name.
Actual Result
If webpack is executed, only errors of one of the ts-loader instances are shown in detail:
[micha@mbp ~/git/ts-loader-mutliple-instances (master)]$ webpack
ts-loader: Using typescript@2.0.0 and /Users/micha/git/ts-loader-mutliple-instances/src/common/tsconfig.json
ts-loader: Using typescript@2.0.0 and /Users/micha/git/ts-loader-mutliple-instances/src/browser/tsconfig.json
Hash: 98e778fd3041495f122c
Version: webpack 1.13.2
Time: 1798ms
Asset Size Chunks Chunk Names
parallel-es.js 4.78 kB 0 [emitted] main
[0] ./src/common/simple.ts 154 bytes {0} [built] [3 errors]
[1] ./src/browser/browser-defaults.ts 123 bytes {0} [built] [2 errors]
ERROR in ./src/browser/browser-defaults.ts
(5,7): error TS2322: Type 'number' is not assignable to type 'string'.
ERROR in ./src/browser/browser-defaults.ts
(5,7): error TS6133: 'a' is declared but never used.
But the output also shows... that simple.ts contains 3 errors, but the error details are not printed to the console (why so ever).
Expected Result
Ts-loader should also output the errors in simple.ts in detail and not only summarize the number of errors behind the asset.
ts-loader: Using typescript@2.0.0 and /Users/micha/git/ts-loader-mutliple-instances/src/common/tsconfig.json
Hash: 80d550dad79efdd5ca47
Version: webpack 1.13.2
Time: 759ms
Asset Size Chunks Chunk Names
parallel-es.js 4.78 kB 0 [emitted] main
[0] ./src/common/simple.ts 154 bytes {0} [built] [3 errors]
[1] ./src/browser/browser-defaults.ts 123 bytes {0} [built] [2 errors]
ERROR in ./src/browser/browser-defaults.ts
(5,7): error TS2322: Type 'number' is not assignable to type 'string'.
ERROR in ./src/browser/browser-defaults.ts
(5,7): error TS6133: 'a' is declared but never used.
ERROR in ./src/common/simple.ts
(3,7): error TS2322: Type 'string' is not assignable to type 'number'.
ERROR in ./src/common/simple.ts
(3,7): error TS6133: 'n' is declared but never used.
ERROR in ./src/common/simple.ts
(4,7): error TS6133: 'x' is declared but never used.
Activity
Emit errors of multiple typescript instances correctly
AlexeyMz commentedon Aug 23, 2016
I'm currently having the same issue.
@jbrantly is there any obstacle to merge #269 ?
johnnyreilly commentedon Oct 26, 2016
Related to #54
johnnyreilly commentedon Nov 2, 2016
Hi @DatenMetzgerX
Sorry about the delay in responding.
I've just given ts-loader a good refactor. The code is essentially the same as it was before, just modularised and slightly more efficient. We'd really like to take your PR if you'd be willing to reapply it to the new codebase. If that's something you'd consider we can assure you of a warm reception!
MichaReiser commentedon Nov 2, 2016
@johnnyreilly
Sorry, I'm actually not using ts-loader anymore. Therefore, I'm not going to rework my PR, sorry.
johnnyreilly commentedon Nov 2, 2016
Fair enough - thanks for letting us know
rileyjbauer commentedon Aug 10, 2018
Should this option be re-opened? I'm still running into the same problem that @MichaReiser described with webpack
4.16.5and ts-loader4.4.2I have two
ts-loaderinstances for different parts of my project, each with their owntsconfig, and when I run with both instances, I just get a small message likeand then
Compiled successfully., but when I run with a single instance, I get a all of the errors and their details and the output ends withFailed to compile.johnnyreilly commentedon Aug 11, 2018
Feel free to open a new issue that links to this with a minimal repro repo.