aws-amplify / aws-amplify/amplify-ui
Incompatible internal imports with "moduleResolution": "bundler" in Angular 20
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 347
- Avg merge
- 18h 29m
- Merged PRs (30d)
- 9
Description
### Before creating a new issue, please confirm:
- [x] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-ui/issues?q=is%3Aissue+) and [discussions](https://github.com/aws-amplify/amplify-ui/discussions).
- [x] I have tried disabling all browser extensions or using a different browser
- [x] I have tried deleting the node_modules folder and reinstalling my dependencies
- [x] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-ui/blob/main/CONTRIBUTING.md#bug-reports).
### On which framework/platform are you having an issue?
Angular
### Which UI component?
Authenticator
### How is your app built?
Angular 20 / Angular CLI / Webpack 5
### What browsers are you seeing the problem on?
_No response_
### Which region are you seeing the problem in?
_No response_
### Please describe your bug.
With the release of Angular 20, the default TypeScript moduleResolution has been updated to "bundler" to align with modern ESM-based tooling and module resolution strategies. After updating from Angular 19 to 20 and keeping moduleResolution as "bundler", I encountered several build-time errors in my project due to internal paths being referenced from the @aws-amplify/ui package.
```
X [ERROR] TS2307: Cannot find module '@aws-amplify/core/dist/esm/Hub/types' or its corresponding type declarations. [plugin angular-compiler]
node_modules/@aws-amplify/ui/dist/types/helpers/authenticator/defaultAuthHubHandler.d.ts:15:108:
15 │ ...r) => import("@aws-amplify/core/dist/esm/Hub/types").StopListen...
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
X [ERROR] TS2307: Cannot find module '@aws-amplify/core/dist/esm/singleton/Auth/types' or its corresponding type declarations. [plugin angular-compiler]
node_modules/@aws-amplify/ui/dist/types/machines/authenticator/defaultServices.d.ts:38:28:
38 │ ...?: import("@aws-amplify/core/dist/esm/singleton/Auth/types").Co...
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
X [ERROR] TS2307: Cannot find module '@aws-amplify/core/dist/esm/singleton/Auth/types' or its corresponding type declarations. [plugin angular-compiler]
node_modules/@aws-amplify/ui/dist/types/machines/authenticator/defaultServices.d.ts:117:28:
117 │ ...?: import("@aws-amplify/core/dist/esm/singleton/Auth/types").C...
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
X [ERROR] TS2307: Cannot find module '@aws-amplify/core/dist/esm/singleton/Auth/types' or its corresponding type declarations. [plugin angular-compiler]
node_modules/@aws-amplify/ui/dist/types/machines/authenticator/defaultServices.d.ts:166:28:
166 │ ...?: import("@aws-amplify/core/dist/esm/singleton/Auth/types").C...
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
X [ERROR] TS2307: Cannot find module '@aws-amplify/core/dist/esm/singleton/Auth/types' or its corresponding type declarations. [plugin angular-compiler]
node_modules/@aws-amplify/ui/dist/types/machines/authenticator/defaultServices.d.ts:200:28:
200 │ ...?: import("@aws-amplify/core/dist/esm/singleton/Auth/types").C...
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
#### Why This Matters:
Projects using modern build tools like Angular 20 (with "moduleResolution": "bundler") or tools like Vite and esbuild now rely on the exports field in package.json to determine module access. Deep imports into dist/esm/... are not resolved in this mode unless explicitly exported, causing these errors.
Temporarily reverting to "moduleResolution": "node" works, but breaks alignment with modern Angular tooling. For long-term compatibility, AWS Amplify packages should support "bundler" mode by exposing all referenced modules in the exports map.
Are you planning to update the amplify packages to support this?
I left some suggestions below on the expected behaviour section. Please feel free to consider them or suggest something else more aligned with your ideas.
Thanks for your work on Amplify!
### What's the expected behaviour?
#### Expected Behaviour:
These internal modules should either:
1. Be properly exported via the package's public API surface (e.g., exposed through the main exports field in package.json), or
2. Avoid referencing internal deep paths in .d.ts files that are not part of the public contract.
#### Suggested Fix:
Please update the @aws-amplify/core and @aws-amplify/ui packages to:
- Avoid referencing private/internal module paths in public type declarations
- Expose all needed modules/types via the exports field in package.json
### Help us reproduce the bug!
1. Create an Angular 20 project and add aws-amplify
2. Use Amplify authenticator features in your project
3. Run either "ng build" or "ng serve"
### Code Snippet
```typescript
// Put your code below this line.
```
### Console log output
_No response_
### Additional information and screenshots
my package.json dependencies are:
```
"dependencies": {
"@angular/animations": "^20.0.3",
"@angular/cdk": "^20.0.3",
"@angular/common": "^20.0.3",
"@angular/compiler": "^20.0.3",
"@angular/core": "^20.0.3",
"@angular/forms": "^20.0.3",
"@angular/material": "^20.0.3",
"@angular/platform-browser": "^20.0.3",
"@angular/platform-browser-dynamic": "^20.0.3",
"@angular/router": "^20.0.3",
"@aws-amplify/ui-angular": "^5.1.3",
"aws-amplify": "^6.15.1",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular/build": "^20.0.2",
"@angular/cli": "~20.0.2",
"@angular/compiler-cli": "^20.0.3",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.6.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.8.3"
}
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the listed Angular 20 dependencies, moduleResolution set to "bundler", and ng build or ng serve. Inspect the @aws-amplify/core and @aws-amplify/ui package exports alongside the generated declarations referencing dist/esm/Hub/types and dist/esm/singleton/Auth/types. Done means the Authenticator declarations resolve without TS2307 errors under bundler resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript, webpack
- Domain
- build-system, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100