Skip to content

multiple instances, errors only shown of single instance #268

Closed

Description

@MichaReiser

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

  1. added a commit that references this issue on Aug 22, 2016
    11e811a
  2. AlexeyMz commented on Aug 23, 2016

    @AlexeyMz

    I'm currently having the same issue.

    @jbrantly is there any obstacle to merge #269 ?

  3. johnnyreilly commented on Oct 26, 2016

    @johnnyreilly
    Member

    Related to #54

  4. johnnyreilly commented on Nov 2, 2016

    @johnnyreilly
    Member

    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!

  5. MichaReiser commented on Nov 2, 2016

    @MichaReiser
    Author

    @johnnyreilly

    Sorry, I'm actually not using ts-loader anymore. Therefore, I'm not going to rework my PR, sorry.

  6. johnnyreilly commented on Nov 2, 2016

    @johnnyreilly
    Member

    Fair enough - thanks for letting us know

  7. rileyjbauer commented on Aug 10, 2018

    @rileyjbauer

    Should this option be re-opened? I'm still running into the same problem that @MichaReiser described with webpack 4.16.5 and ts-loader 4.4.2

    I have two ts-loader instances for different parts of my project, each with their own tsconfig, and when I run with both instances, I just get a small message like

    ./test/components/test-runner.ts] 1.05 KiB {index} [built] [3 errors]
    

    and 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 with Failed to compile.

  8. johnnyreilly commented on Aug 11, 2018

    @johnnyreilly
    Member

    Feel free to open a new issue that links to this with a minimal repro repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions