Reputation: 678
The command npm run build
successfully build the package and the app runs in browser just fine.
But the VS2019 keeps complaining with
Error TS2307 (TS) Cannot find module '...'. Miscellaneous.
Is there a setting in the IDE where some things should be changed to make the the VS as happy as the npm?
EDIT
Restart of the IDE resolved one line but not the other
Upvotes: 4
Views: 1608
Reputation: 678
The answer is yes. There are settings in the project that might make the experience somewhat inconsistent.
VS uses project file (.csproj
) and IDE default settings to configure typescript intellisence when the tsconfig.json
file is not part of the project. The npm run build
command (or similar CLI approach) on the other hand uses the tsconfig.json
all the time. This may lead to mixed experience. Indeed VS will show false hints and errors if particular settings differ in .csproj
and in tsconfig.json
.
Make sure tsconfig.json relates to the build process as Content (rather than None) yet never copied to the output directory. This way you force the IDE to detect your settings and use them.
Upvotes: 3