Webstorm cannot find imports after rebuild

I have imports from a shared library in my monorepo:

import Pizza from '@app/shared/build/pizza'


These work fine until I delete the `packages/shared/build` folder and rebuild it during the build process. (For various reasons I need to delete the folder and re-build it.) When the folder gets deleted, Webstorm rightly complains that it can't find the imports, but then it never refreshes subsequently once they're back (15 seconds or so later). I need to restart Webstorm to get the imports to work again.

How can I get Webstorm to refresh these imports after they've (briefly) disappeared, without restarting?

 

1
4 comments

What error do you see namely? Also, does re-loading the files from disk (File > reload all From Disk) help?

0

Elena Pogorelova The imports show up with the red squiggly underline; hovering on them shows the error: `TS2307: Cannot find module '@app/shared/build/pizza'`. A Typescript error, obviously, so possibly this issue is with the Typescript plugin? Unfortunately File > Reload All From Disk has no effect.

0

does restarting TS service help? To re-start it, click on Typescript <version> widget in the status bar, and then choose Restart TypeScript Service

1

The issue is still present

It appears when, in the rebuild process of the dependency, you are deleting the files and recreating them.

The only solution is to restart typescript servicer each time but it is really boring

0

Please sign in to leave a comment.