You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @momsse, this is answered in #53. The TL;DR is:
you can add a new path alias before the "main" one, like so:
"paths": {// This need to be first, so index imports can be matched by the next alias.// You can add or omit the `src` part here, depending on your preference.// V"@nighttrax/foo/*": ["packages/foo/*"],"@nighttrax/*": ["packages/*/src"]}
doing the above will break publishing, unless you:
use the aliases during building as well,
publish from within the dist/ folder, after you've copied your package.json there.
using imports like this makes library APIs more brittle, as changes in the folder structure can break consumers.
Hi @NiGhTTraX,
Thanks for the article and sharing your work 馃憣
I tried to add an extra
foo/src/demo.ts
module and importing it frombar/src/index.ts
after addingfiles: ["dist"]
onfoo/package.json
.Both syntaxes ends with
Error: Cannot find module '@nighttrax/foo/[src/]demo
Is it possible to import non "main" modules (without having to import and export them from the main one)?
All typescript mono repo examples that I found so far showcase the same kind of example of package
a
import moduleb
's single exported main module.The text was updated successfully, but these errors were encountered: