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

Error: Unexpected value 'ChartModule' imported by the module 'AppModule' #75

Closed
michael-brade opened this issue Sep 29, 2016 · 9 comments
Assignees

Comments

@michael-brade
Copy link

I am using angular2-highcharts with Ionic 2 RC.0. But I am getting the following error:

[12:52:35]  ngc error: Error: Unexpected value 'ChartModule' imported by the module 'AppModule'
    at node_modules/@angular/compiler/bundles/compiler.umd.js:14113:37
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (node_modules/@angular/compiler/bundles/compiler.umd.js:14096:46)
    at node_modules/@angular/compiler/bundles/compiler.umd.js:12937:58
    at Array.forEach (native)
    at OfflineCompiler.analyzeModules (node_modules/@angular/compiler/bundles/compiler.umd.js:12936:21)
    at CodeGenerator.codegen (node_modules/@angular/compiler-cli/src/codegen.js:105:47)

I am using it like this:

// app.module.js
import { ChartModule } from 'angular2-highcharts';

@NgModule({
  imports: [
    ...
    ChartModule, 
    ...
  ],
  ...
})
export class AppModule { }

Error happens when I do npm run build. Any ideas?

@michael-brade
Copy link
Author

BTW, npm run watch gives me:

[13:13:50]  Error: Module node_modules/angular2-highcharts/index.js does not export ChartModule (imported by .tmp/app/app.module.js)
    at Module.trace (node_modules/rollup/dist/rollup.js:7677:29)
    at ModuleScope.findDeclaration (node_modules/rollup/dist/rollup.js:7300:22)
    at Scope.findDeclaration (node_modules/rollup/dist/rollup.js:5351:39)
    at Identifier.bind (node_modules/rollup/dist/rollup.js:6489:29)
    at node_modules/rollup/dist/rollup.js:5151:50
    at ArrayExpression.eachChild (node_modules/rollup/dist/rollup.js:5165:19)
    at ArrayExpression.bind (node_modules/rollup/dist/rollup.js:5151:7)
    at node_modules/rollup/dist/rollup.js:5151:50
    at Node.eachChild (node_modules/rollup/dist/rollup.js:5168:5)
    at Node.bind (node_modules/rollup/dist/rollup.js:5151:7)

@Fank
Copy link
Collaborator

Fank commented Sep 29, 2016

Works fine:

$ npm run watch

> [email protected] watch /home/mfkinder/Desktop/angular2-highcharts
> tsc -w

1:29:23 PM - Compilation complete. Watching for file changes.

@michael-brade
Copy link
Author

hm. Are you using this with Ionic 2?

@Fank
Copy link
Collaborator

Fank commented Sep 29, 2016

no, default angular2.

@michael-brade
Copy link
Author

michael-brade commented Sep 29, 2016

ok, then I think there is something that doesn't play nicely with the current Ionic 2 release candidate. It has its own build and watch scripts under @ionic/app-scripts.

@singhjusraj
Copy link

This happens when using AoT compilation in Angular 2.

When I try to run ngc, it errors out as following:

Error: Unexpected value 'ChartModule' imported by the module 'ReportsModule' at C:\Users\sukhdeep\Documents\Angular\gd_dev_server\node_modules\@angular\compiler\bundles\compiler.umd.js:14109:37 at Array.forEach (native) at CompileMetadataResolver.getNgModuleMetadata (C:\Users\sukhdeep\Documents\Angular\gd_dev_server\node_modules\@angular\compiler\bundles\compiler.umd.js:14094:46)

I believe it has resemblance to the issue #70

the metadata.json files are missing from the library which are required by ngc.
I'm using default angular 2, no ionic here.

Can those missing files be added soon?
Thanks.

@Fank
Copy link
Collaborator

Fank commented Sep 29, 2016

Sure, but i realy don't how they should looks like or how they will be generated.

@singhjusraj
Copy link

node_modules

every core angular package has an index.metadata.json file which is utilized by ngc during compilation.

If you reference to this issue angular/angular#11262

They say that these metadata files are auto-generated by ngc.
So if you try to compile this library with ngc, I believe the metadata file will be autogenerated.

@Fank Fank self-assigned this Sep 29, 2016
@Fank
Copy link
Collaborator

Fank commented Sep 29, 2016

@Sukh9212 yea it does PR is on the way

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

3 participants