Skip to content

Other loaders are not applied to unchanged files in watch mode #1111

@iorate

Description

@iorate

Expected Behaviour

In watch mode, unchanged .ts files should be passed to loaders other than ts-loader, as in v6.2.2.

Actual Behaviour

Unchanged .ts files are not passed to other loaders.

Steps to Reproduce the Problem

Please see the below repository. The version of ts-loader is 7.0.4.

./app.ts and ./error.ts are transpiled using ./remove-error-loader.js and ts-loader (in this order). ./error.ts has an "error", but it is removed by ./remove-error-loader.js.
When I run npx webpack --watch, it seems to be working well at first:

% npx webpack --watch

webpack is watching the files…

Hash: f695893648cef87b9d90
Version: webpack 4.43.0
Time: 981ms
Built at: 2020/05/17 22:18:19
    Asset      Size  Chunks             Chunk Names
bundle.js  8.93 KiB    main  [emitted]  main
Entrypoint main = bundle.js
[./app.ts] 90 bytes {main} [built]
[./error.ts] 0 bytes {main} [built]

However, when I update ./app.ts (for example, change 'Hello' to 'Hello, world!'), an error occurs:

Hash: a3f00bec5e5882c9d219
Version: webpack 4.43.0
Time: 39ms
Built at: 2020/05/17 22:18:25
    Asset      Size  Chunks             Chunk Names
bundle.js  8.95 KiB    main  [emitted]  main
Entrypoint main = bundle.js
[./app.ts] 98 bytes {main} [built]
    + 1 hidden module

ERROR in C:\Users\iorate\ts-loader-error\error.ts
./error.ts
[tsl] ERROR in C:\Users\iorate\ts-loader-error\error.ts(1,1)
      TS2552: Cannot find name 'error'. Did you mean 'Error'?

This means that ./error.ts (unchanged) is compiled by a TypeScript compiler, but not processed by ./remove-error-loader.js before that.

With [email protected], an update of ./app.ts does not cause an error:

Hash: 412257a27b607df16d5e
Version: webpack 4.43.0
Time: 29ms
Built at: 2020/05/17 22:16:30
    Asset      Size  Chunks             Chunk Names
bundle.js  8.95 KiB    main  [emitted]  main
Entrypoint main = bundle.js
[./app.ts] 98 bytes {main} [built]
    + 1 hidden module

Is this regression, or expected behavior in v7?

Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/iorate/ts-loader-error

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