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

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

Closed
Renaud009 opened this issue Oct 18, 2016 · 10 comments
Closed

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

Renaud009 opened this issue Oct 18, 2016 · 10 comments

Comments

@Renaud009
Copy link

Renaud009 commented Oct 18, 2016

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')],
@BioSin
Copy link

BioSin commented Oct 24, 2016

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

@anil1712
Copy link

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

@jmbarbier
Copy link

Solved same problem while using v6 with @Renaud009 solution.

@sachanacar
Copy link

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

@tom10271
Copy link

Same error and I use SystemJs too

@sachanacar
Copy link

@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?

@joshwiens
Copy link
Contributor

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

@sachanacar
Copy link

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

@joshwiens
Copy link
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.

@sachanacar
Copy link

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants