I'm happy about to have moduleResolution option but I think that node and classic are insufficient.
I would like to have a mixed option. When you are using node_modules you have to use node option but I continue having custom libraries in development that I use in my projects.
This was my folder estructure:
Root
| -tolemac
| |- helper.ts
| -app
|- customer.ts
|- customer-details.ts
|- invoice.ts
|- delivery-note.ts
I used --modeResolution: "classic" and I have in customer.ts:
import {helperFunction} from "tolemac/helper";
...
Then I decided to make a subfolder for each section on my domain:
Root
| -tolemac
| |- helper.ts
| -app
|- customers
| |- customer.ts
| |- customer-details.ts
|- invoices
|- invoice.ts
|- delivery-note.ts
And all works fine.
Then I've started to use some node modules like es6-shims and others, then I have changed the options to --moduleResolution: "node".
I can load node_modules, but all my files in my app have failed on compile, ts don't found tolemac/helper module ...
I have to change customer.ts and all others to:
import {helperFunction} from "../../tolemac/helper";
...
Its ok, but if do I decide to make other change??
Perhaps the best option would be to have a "--moduleRoot" option where you can set an array with the paths to the modules and typescript would search modules in these paths with the same order. For example:
--moduleRoot: ["node_modules", "."],
Typescript would look for modules on "node_modules" and if not found then search in the current.
The routes would be relatives to "tsconfig.json", this is important, I have folder structures like:
Root
| -app1
| | -tolemac
| | |- helper.ts
| |- customers
| | |- customer.ts
| | |- customer-details.ts
| |- invoices
| | |- invoice.ts
| | |- delivery-note.ts
| |- tsconfig.json **
| -app2
| |- customers
| | |- customer.ts
| | |- customer-details.ts
| |- invoices
| | |- invoice.ts
| | |- delivery-note.ts
| |- tsconfig.json **
|- node_modules
|- package.json
Then my options would be:
--moduleRoot: ["../node_modules", "."],
For both tsconfig.json files.
I'm happy about to have
moduleResolutionoption but I think thatnodeandclassicare insufficient.I would like to have a
mixedoption. When you are usingnode_modulesyou have to usenodeoption but I continue having custom libraries in development that I use in my projects.This was my folder estructure:
I used
--modeResolution: "classic"and I have incustomer.ts:Then I decided to make a subfolder for each section on my domain:
And all works fine.
Then I've started to use some node modules like
es6-shimsand others, then I have changed the options to--moduleResolution: "node".I can load node_modules, but all my files in my app have failed on compile, ts don't found
tolemac/helpermodule ...I have to change
customer.tsand all others to:Its ok, but if do I decide to make other change??
Perhaps the best option would be to have a "--moduleRoot" option where you can set an array with the paths to the modules and typescript would search modules in these paths with the same order. For example:
Typescript would look for modules on "node_modules" and if not found then search in the current.
The routes would be relatives to "tsconfig.json", this is important, I have folder structures like:
Then my options would be:
For both
tsconfig.jsonfiles.