TypeStrong / fork-ts-checker-webpack-plugin

Webpack plugin that runs typescript type checker on a separate process.
MIT License
1.96k stars 239 forks source link

A linked dep's re-build while dev server is running causes TypeScript to not be able to find the dep anymore #771

Open fabis94 opened 2 years ago

fabis94 commented 2 years ago

Current behavior

So I have a monorepo using yarn 3.x workspaces and there's a package with webpack that depends on another package which is symlinked through yarn. The problem is that while a webpack dev server is running if I re-build that linked dependency, fork-t-schecker-webpack-plugin is no longer able to find that dependency, even after the linked rebuild has finished and there are definitely files there.

ERROR in src/main/lib/viewer/core/helpers/cameraHelper.ts:2:24
TS2307: Cannot find module '@speckle/viewer' or its corresponding type declarations.
    1 | import { Vector3 } from 'three'
  > 2 | import { Viewer } from '@speckle/viewer'
      |                        ^^^^^^^^^^^^^^^^^
    3 | import CameraControls from 'camera-controls'
    4 |
    5 | // wtf

The error above is being thrown even though @speckle/viewer (a linked package) has already been rebuilt and definitely exists at that point.

Expected behavior

After the linked package finishes rebuilding, fork-ts-checker-webpack-plugin should clear out its cache and re-evaluate whether the previously missing module and its types are still missing. They aren't, so it should pick up on that and stop reporting an error that no longer exists.

Issue reproduction repository

Here's a reproduction link: https://github.com/specklesystems/speckle-server/pull/889

Steps to reproduce the issue

Environment