My TypeScript projects have a structure where the source code is separated from the tests into different directories (src
and test
). When packaging the final product, I only want to include the source code without the tests because the runtime doesn't need test files. However, I'm facing some issues in my environment. I use Doom Emacs and Tide throws errors related to TypeScript when running tests:
Error from syntax checker typescript-tide: Error processing request. No Project.
Error: No Project.
at Object.ThrowNoProject (/Users/ikaraszi/.../node_modules/typescript/lib/tsserver.js:152133:23)
If I modify the tsconfig.json
settings to include the test
directory, the Tide errors disappear, but the distribution structure changes to have both a dist/src
and a dist/test
, which leads to awkward import statements for library users like:
import { foo } from 'library/dist/src/foo';
I want to avoid this extra level in the import path if possible. I've tried adjusting the include
property in the tsconfig.json
file to have both src
and test
, but it still results in the same nested directory structure in the dist
folder.
Is there a way I can achieve the desired result without adding an extra build step to remove unnecessary directories?