Skip to content

Unexpected value 'MyCustomModule' imported by the module 'AppModule' #1114

Closed

Description

@Renaud009

Today I had trouble importing an external component with Application NgModule. Following this issue angular/angular#11438 it led me to consider it had to do with Webpack configuration.

Unexpected value 'MyCustomModule' imported by the module 'AppModule'
(anonymous function)    @   metadata_resolver.js:293
CompileMetadataResolver.getNgModuleMetadata @   metadata_resolver.js:280
RuntimeCompiler._compileComponents  @   runtime_compiler.js:142
RuntimeCompiler._compileModuleAndComponents @   runtime_compiler.js:80
RuntimeCompiler.compileModuleAsync  @   runtime_compiler.js:71
PlatformRef_._bootstrapModuleWithZone   @   application_ref.js:321
PlatformRef_.bootstrapModule    @   application_ref.js:303
main    @   main.browser.ts:18
ZoneDelegate.invokeTask @   zone.js:236
Zone.runTask    @   zone.js:136
ZoneTask.invoke @   zone.js:304

If it happens to anyone else, note that changing this line in webpack.common.js of current project worked well for me:

modules: [helpers.root('src'), helpers.root('node_modules')],

Activity

  1. BioSin commented on Oct 24, 2016

    @BioSin

    +1, I had the same problem, changing
    modules: [helpers.root('src'), 'node_modules']
    to
    modules: [helpers.root('src'), helpers.root('node_modules')],
    helped me

  2. anil1712 commented on Oct 26, 2016

    @anil1712

    I am getting below error while running AoT. I am using System.js.

    ngc -p tsconfig-aot.json

    Error: Unexpected value 'NgSemanticModule' imported by the module 'AppModule'
    at F:\project_web\node_modules@angular\compiler\bundles\compiler.umd.js:13996:37
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (F:\project_web\node_modules@angular\compiler\bundles\compiler.umd.js:13981:46)
    at F:\project_web\node_modules@angular\compiler\bundles\compiler.umd.js:12801:47
    at Array.forEach (native)
    at analyzeModules (F:\project_web\node_modules@angular\compiler\bundles\compiler.umd.js:12800:17)
    at OfflineCompiler.analyzeModules (F:\project_web\node_modules@angular\compiler\bundles\compiler.umd.js:12826:18)

    Please help me to out of it

  3. jmbarbier commented on Nov 16, 2016

    @jmbarbier

    Solved same problem while using v6 with @Renaud009 solution.

  4. sachanacar commented on Jan 11, 2017

    @sachanacar

    Hey @anil1712, I'm also having the same problem and I also use SystemJS. All answers I see online are for Webpack sadly :(

  5. tom10271 commented on Jan 12, 2017

    @tom10271

    Same error and I use SystemJs too

  6. sachanacar commented on Jan 12, 2017

    @sachanacar

    @tom10271 I've been trying to use systemjs-builder to bundle files together.

    However, I'm getting "TypeError: Cannot read property 'annotations' of undefined" in the console when I try to load the bundle.

    I know Webpack has a plugin to automatically load the bundle in the browser, does SystemJS have that too?

  7. joshwiens commented on Jan 12, 2017

    @joshwiens
    Contributor

    @sachanacar - This is definitely the wrong place to inquire about SystemJS

  8. sachanacar commented on Jan 12, 2017

    @sachanacar

    @d3viant0ne true, I'm just desperate for answers!

  9. joshwiens commented on Jan 12, 2017

    @joshwiens
    Contributor

    I started using systemjs, the best advice I could give you at this point is bite the bullet, convert whatever project you are running to Webpack and save yourself the aggravation.

    Future specs aside, Webpack ended up with all of the community support which is what eventually got me to make the switch about 6 months ago. I haven't regretted that decision personally or professionally.

  10. sachanacar commented on Jan 12, 2017

    @sachanacar

    @d3viant0ne thanks, I'll try to convince the team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions