TypeStrong/fork-ts-checker-webpack-plugin

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

fabis94 opened this issue · 0 comments

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: specklesystems/speckle-server#889

Steps to reproduce the issue

  • Checkout the branch
  • Run yarn dev:frontend from repo root to run the webpack dev server
  • Once its running, run yarn dev from 'packages/viewer'
  • The frontend dev server will rebuild, but wont be able to find the linked viewer dependency anymore

Environment

  • fork-ts-checker-webpack-plugin: tried ^5 and ^6
  • typescript: 4.5.4
  • eslint: [version from the package.json] 8.11.0
  • webpack: [version from the package.json] 4.46.0
  • os: [e.g. Ubuntu 19.04] Ubuntu 20