Can't resolve modules from custom path
See original GitHub issue🐞 bug report
Description
When trying to serve the app using custom paths on tsconfig.json for some libs I created everything works fine, however, when trying to build it using AOT, I get multiple errors:
ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve 'some_module' in 'some_path '
Works fine when AOT is set to false.
Additional Information
Here is my tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"paths": {
//Env
"@env/*": ["src/environments/*"],
//Libs
"@lib/pipes": ["dist/pipes"],
"@lib/pipes/*": ["dist/pipes/*"],
"@lib/utils": ["dist/utils"],
"@lib/utils/*": ["dist/utils/*"],
"@lib/directives": ["dist/directives"],
"@lib/directives/*": ["dist/directives/*"],
"@lib/models": ["dist/models"],
"@lib/models/*": ["dist/models/*"],
"@lib/websocket": ["dist/websocket"],
"@lib/websocket/*": ["dist/websocket/*"],
"@lib/intl-phone-input": ["dist/intl-phone-input"],
"@lib/intl-phone-input/*": ["dist/intl-phone-input/*"]
}
}
}
🌍 Your Environment
**Angular Version:**
Angular CLI: 8.0.0
Node: 12.3.1
OS: darwin x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.800.0
@angular-devkit/core 8.0.0
@angular-devkit/schematics 8.0.0
@schematics/angular 8.0.0
@schematics/update 0.800.0
rxjs 6.4.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
TypeScript config can't resolve custom paths with ESM enabled
I've been trying to crack this thing down for quite a while now, I want my tsconfig.json paths to be resolved when ESM...
Read more >Documentation - Module Resolution - TypeScript
Use non-relative paths when importing any of your external dependencies. Module Resolution Strategies. There are two possible module resolution strategies: Node ...
Read more >Module Resolution - webpack
A resolver is a library which helps in locating a module by its absolute path. A module can be required as a dependency...
Read more >"Can't resolve '@models/IUser'" when working with typescript ...
Hello all. I'm a bit new to typescript and I looked into the very promising feature of "paths".But when I try to implement...
Read more >Common TypeScript module problems and how to solve them
Solution 1: Locate the correct directory ; "compilerOptions": ; "baseUrl": ; ".", ; "paths": ; "express": ...
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
Provide a repro…
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.