Skip to content
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

Type <typename> in <path> is part of the declaration of 2 modules... #30

Closed
skorunka opened this issue Jan 19, 2018 · 14 comments
Closed

Comments

@skorunka
Copy link

Hi, I got this error after loading tsconfig.app.json.

image

{
	"extends": "../tsconfig.json",
	"angularCompilerOptions": {
		"paths": {
			"eyc-sol-ant-pln": [ "../my-lib/src/public_api.ts" ]
		}
	},
	"compilerOptions": {
		"outDir": "../out-tsc/app",
		"module": "es2015",
		"baseUrl": "",
		"types": [],
		"paths": {
			"eyc-sol-ant-pln": [ "../my-lib/src/public_api.ts" ]
		}
	},
	"exclude": [ "test.ts", "**/*.spec.ts", "**/*.mock.ts" ]
}

I don't really think, the module is declared in two modules, it is only declared in CoreModule:

image

Isn't it the problem with paths (/ vs \, I'm on Win10)?

@mgechev
Copy link
Owner

mgechev commented Jan 19, 2018

Would you share a small sample app to help me reproduce the issue?

@skorunka
Copy link
Author

I will try... will post it here once ready. Thank you.

@jbgraug
Copy link

jbgraug commented Feb 8, 2018

Same here... getting this error in latest version 0.17 for mac.

Cannot parse your project.
Make sure it's compatible with the Angular's AoT compiler. Error during parsing:
{
    "__zone_symbol__currentTask":{
       "type":"microTask",
       "state":"notScheduled",
       "source":"Promise.then",
       "zone":"angular",
       "cancelFn":null,
       "runCount":0
  }
}

is it possible to activate dev tools? to be able to give more info?

@mgechev
Copy link
Owner

mgechev commented Feb 8, 2018

ngrev doesn't support the exclude and include properties of tsconfig.json. Try to drop them and see if it works.

@paulsperanza
Copy link

paulsperanza commented Feb 8, 2018

I took the following out of tsconfig.app.json. (CLI 1.6.3)

,"exclude": [
"test.ts",
"**/*.spec.ts"
]

I now get this error:

Cannot parse your project. Make sure it's compatible with the Angular's AoT compiler. Error during parsing:

Type AttachmentCanvasComponent in C:/Projects/MpWebAngCli/src/MpWebAngCli/ClientApp/src/app/canvases/attachment/attachment-canvas.component.ts is part of the declarations of 2 modules: CanvasRoutingModule in C:/Projects/MpWebAngCli/src/MpWebAngCli/ClientApp/src/app/canvases/canvas-routing.module.ts and CanvasRoutingModule in C:\Projects\MpWebAngCli\src\MpWebAngCli\ClientApp\src\app\canvases\canvas-routing.module.ts! Please consider moving AttachmentCanvasComponent in C:/Projects/MpWebAngCli/src/MpWebAngCli/ClientApp/src/app/canvases/attachment/attachment-canvas.component.ts to a higher module that imports CanvasRoutingModule in C:/Projects/MpWebAngCli/src/MpWebAngCli/ClientApp/src/app/canvases/canvas-routing.module.ts and CanvasRoutingModule in C:\Projects\MpWebAngCli\src\MpWebAngCli\ClientApp\src\app\canvases\canvas-routing.module.ts. You can also create a new NgModule that exports and includes AttachmentCanvasComponent in C:/Projects/MpWebAngCli/src/MpWebAngCli/ClientApp/src/app/canvases/attachment/attachment-canvas.component.ts then import that NgModule in CanvasRoutingModule in C:/Projects/MpWebAngCli/src/MpWebAngCli/ClientApp/src/app/canvases/canvas-routing.module.ts and CanvasRoutingModule in C:\Projects\MpWebAngCli\src\MpWebAngCli\ClientApp\src\app\canvases\canvas-routing.module.ts.

@mgechev
Copy link
Owner

mgechev commented Feb 9, 2018

Would you share a minimum demo I can reproduce the issue with?

@riscie
Copy link

riscie commented Feb 22, 2018

I'm having the same issue (on Windows 10). I try to produce a minimal project where this happens because I can not share the one I've tried to use ngrev with.

@mgechev
Copy link
Owner

mgechev commented Feb 22, 2018

@riscie make sure your project's tsconfig doesn't have exclude and include properties. That's a workaround you can apply for now. At some point, ngrev should start supporting them as well.

@riscie
Copy link

riscie commented Feb 23, 2018

@mgechev that does not cut it for me, I get the same error with or without exclude / include properties.

@augustincalin
Copy link

Actually, reproducing this is quite simple (Windows 10).

ng --version

Angular CLI: 1.6.7
Node: 8.9.4
OS: win32 x64
Angular: 5.2.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.7
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.7
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0

  1. create new angular cli project: ng new ng-rev
  2. cd ng-rev
  3. generate a module: ng g m ModuleOne
  4. add a component in this module: cd src\app\module-one\ and then ng g c ComponentOne.
  5. export ComponentOneComponent from module-one.module.ts:
    exports: [ComponentOneComponent]
  6. add ModuleOneModule in app.module.ts imports: imports: [BrowserModule, ModuleOneModule]
  7. Try to open the project in ngrev. You will see the error.

@mgechev
Copy link
Owner

mgechev commented Mar 2, 2018

@augustincalin perfect! Will try to reproduce your steps on Windows in the next few weeks. Not sure if I'll be able to do that by the end of March but will do my best.

@mgechev
Copy link
Owner

mgechev commented Apr 11, 2018

@augustincalin would you try again? Version 0.0.18 updates the compiler.

@aaron-bond
Copy link

Hi @mgechev, I had the same issue as @augustincalin before 0.0.18. Now, I get this message:
image

I can't share the source, sorry - but I wanted to share the error just in case it was useful to you.

@mgechev
Copy link
Owner

mgechev commented Apr 26, 2018

This is unrelated to the reported original issue.

@mgechev mgechev closed this as completed Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants