feature: acknowledge tsconfig paths
See original GitHub issueWhat I would like to do is have multiple packages in the same repo. So far everything works well EXCEPT, I have one package that depends on another I have the paths defined in the tsconfig so that I can use the correct module name during development and testing.
{
...
"baseUrl": "./",
"paths": {
"@livesafe/common": [
"./src/app/common/public_api.ts"
],
"@livesafe/dialog": [
"./src/app/dialog/public_api.ts"
]
}
}
Everything works great for dev but falls over when trying to generate the bundle for @livesafe/dialog I get the following error.
Looking through the code I couldn’t find a way to configure paths for the ngc step of the build.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (9 by maintainers)
Top Results From Across the Web
How to use paths in tsconfig.json?
This can be set up on your tsconfig.json file, as it is a TS feature. You can do like this: "compilerOptions": { "baseUrl":...
Read more >TypeScript: Documentation - Module Resolution
Use non-relative paths when importing any of your external dependencies. ... Traditionally, imports in Node.js are performed by calling a function named ...
Read more >tsconfig paths not recognized
In the root of my project I have a tsconfig.base.json. where. ... However, when I am using Resharper, it does not recognize the...
Read more >Restructure with ease thanks to Typescript path mappings
In our tsconfig.json file we first need to set a baseUrl to tell the compiler where the paths are starting from. In our...
Read more >Short TypeScript Import Paths in Angular9 - Bits and Pieces
The first thing is that your IDE can highlight whether the import paths are right or wrong. If your IDE cannot recognize the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have a similar problem. Following a suggestion for making environment variables reusable, I added the following to the tsconfig:
"compilerOptions": { . . . "paths": { "@env/*": ["environments/*"] } },
That is so I can use something like:
import { environment } from "@env/environment";
Rather than a relative path to the evironment.ts file that exists outside the modules base folder I will be packaging up. Of course when I go to run npm run build:lib to execute ng-packagr I get the error that @env module does not exist. I am having a little trouble deciphering some of the suggestions above. Is there an approach that will work to fix this problem? I would like to use environment variables in place of hard coding values that will change based on the application my npm package is running in. I thought I had a solution with @env/environment but ng-packagr will not allow it.No, not yet. There’s two sides of it:
dependsOn: [ "path/to/other/package.json" ]
that will build the dependee package first and then build the dependent.