Fork-ts-checker-webpack-plugin: TS6305: Output file '/path/to/dist/index.d.ts' has not been built from source file '/path/to/src/index.ts'.

Created on 24 Feb 2020  路  3Comments  路  Source: TypeStrong/fork-ts-checker-webpack-plugin

Current behavior

You receive a TS6305 error when using the fork-ts-checker-webpack-plugin. The error does not show up when not using the plugin. Running the build again without running a cleanup script to remove the output directory and buildinfo file will result in a no error being outputted. See the steps to reproduce for more info.

Expected behavior

You either receive this error consistently when using or not using the plugin, or don't receive the error at all.

Steps to reproduce the issue

https://github.com/mvargeson/fork-ts-checker-webpack-plugin-resolution-issue#how-to-reproduce

Issue reproduction repository

https://github.com/mvargeson/fork-ts-checker-webpack-plugin-resolution-issue

Environment

  • fork-ts-checker-webpack-plugin: 4.0.4
  • typescript: 3.8.2
  • tslint: N/A
  • webpack: 4.41.5
  • os: macOS 10.15.3
  • node: 12.16.0
bug

Most helpful comment

I did a little bit of digging into this and I think it's a race condition when building.

I believe this stems from fork-ts-checker and ts-loader running in parallel. Typescript composite projects rely on the dist files being emitted and on disk, so if fork-ts-checker starts typechecking a module that ts-loader hasn't emitted yet, the above error would likely occur. That also explains why running build a second time resolves the issue (since the older files are already on disk). This could potentially result in changes not being type-checked if on-disk files were stale.

I don't have any concrete evidence to back this up but I think it's plausible...

All 3 comments

I did a little bit of digging into this and I think it's a race condition when building.

I believe this stems from fork-ts-checker and ts-loader running in parallel. Typescript composite projects rely on the dist files being emitted and on disk, so if fork-ts-checker starts typechecking a module that ts-loader hasn't emitted yet, the above error would likely occur. That also explains why running build a second time resolves the issue (since the older files are already on disk). This could potentially result in changes not being type-checked if on-disk files were stale.

I don't have any concrete evidence to back this up but I think it's plausible...

@mvargeson , @berickson1
Please try fork-ts-checker-webpack-plugin@alpha - I've published a new version which should resolve this issue 馃殌
I will close this issue to clean-up the backlog. If this release didn't solve the issue, we can re-open this :)

@piotr-oles - Tried this on 5.0.0-alpha.14 and it seems to resolve this issue. Thanks!

Note: I did run into #433 when testing this

cc: @mvargeson

Was this page helpful?
0 / 5 - 0 ratings

Related issues

geirsagberg picture geirsagberg  路  5Comments

pelotom picture pelotom  路  4Comments

neoneo picture neoneo  路  3Comments

urielvan picture urielvan  路  7Comments

piotr-oles picture piotr-oles  路  3Comments