Skip to content

Dual app has duplicate declarations error only with AOT #6189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zackarychapple opened this issue May 5, 2017 · 5 comments
Closed

Dual app has duplicate declarations error only with AOT #6189

zackarychapple opened this issue May 5, 2017 · 5 comments

Comments

@zackarychapple
Copy link
Contributor

- [x] bug report -> please search issues before submitting

Versions.

@angular/cli: 1.0.2
node: 7.5.0
os: darwin x64
@angular/common: 4.1.1
@angular/compiler: 4.1.1
@angular/core: 4.1.1
@angular/forms: 4.1.1
@angular/http: 4.1.1
@angular/platform-browser: 4.1.1
@angular/platform-browser-dynamic: 4.1.1
@angular/router: 4.1.1
@angular/cli: 1.0.2
@angular/compiler-cli: 4.1.1

Repro steps.

I created a repo that replicates this issue.

  1. Create Second app in .angular-cli.json with unique main file.
  2. Create Duplicate of app.module.ts and name it `app2.module.ts
  3. Run ng build everything works as expected
  4. Run ng build --prod --aot and get the below error:

The log given by the failure.

ERROR in Type AppComponent in /Users/zchapple/code/test/src/app/app.component.ts is part of the declarations of 2 modules: AppModule in /Users/zchapple/code/test/src/app/app.module.ts and AppModule in /Users/zchapple/code/test/src/app/app2.module.ts! Please consider moving AppComponent in /Users/zchapple/code/test/src/app/app.component.ts to a higher module that imports AppModule in /Users/zchapple/code/test/src/app/app.module.ts and AppModule in /Users/zchapple/code/test/src/app/app2.module.ts. You can also create a new NgModule that exports and includes AppComponent in /Users/zchapple/code/test/src/app/app.component.ts then import that NgModule in AppModule in /Users/zchapple/code/test/src/app/app.module.ts and AppModule in /Users/zchapple/code/test/src/app/app2.module.ts.

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/zchapple/code/test/src'
 @ ./src/main.ts 4:0-74
 @ multi ./src/main.ts

Desired functionality.

Expected behavior is that the apps should be evaluated independently for duplicate module AOT checks.

@sumitarora sumitarora self-assigned this May 5, 2017
@veke
Copy link

veke commented Jul 12, 2017

If multiple apps and --app appname is used which has different main.ts entry point (which imports different module that imports same components) will give build error with --aot
error in Type AppComponent ... is part of the declarations of 2 modules

@veke
Copy link

veke commented Sep 14, 2017

Any news on this?
@hansl

@manuelhuber
Copy link

manuelhuber commented Oct 17, 2017

This is a major issues and prevents us from using Component Lab (but there is a workaround, see this)

@veke
Copy link

veke commented Oct 17, 2017

#8031

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants