main need to change for typescript/javascript #4256
-
I am trying to create a proof of concept of turbo repo to promote it in my company. I have ended up where I want and here is the repository: https://github.com/trixobird/turborepo It is just an express server that is using apart from the things in tutorial (eslint, tsconfig) a logger. There is one thing that I cannot do. As the repo stands Dockerfile works and I have a working express server that is under 200MB, very cool. But the I think my problem should have an easy solution, but I am failing to find it, could you help me please?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The issue you're encountering is because of the discrepancy between the main and types fields in the packages/logger/package.json file. When you set the main field to "./dist/index.js", you're telling Node.js to use the compiled JavaScript file when importing the package. However, when you set the types field to "./src/index.ts", you're telling TypeScript to use the TypeScript file when importing the package. |
Beta Was this translation helpful? Give feedback.
No, because the package needs to have its exports explicitly marked when working within the bounds of the repository.
I'd encourage you to use
./dist/index.js
in this case, and usetsc --watch
for your dev script. That way, both builds and local development will be able to use./dist/index.js
.