I am developing a Third Party library using Rollup and NGC to hold common 
functionality among a few of my applications. It has been smooth sailing so 
far, but now I am stuck and have been blocked for a few days. I am 
attempting to create my first submodule in the library, previously I was 
only using top level modules which were all scoped, following the Angular 
format. The submodule works fine in JiT mode, but I receive the following 
error when running it in AoT.

ERROR in : Unexpected value 'TestModule in test.module.d.ts' imported by 
the module 'AppModule in app.module.ts'. Please add a @NgModule annotation.

Looking at the bundles created by the compiler, everything looks fine, but 
upon further investigation and comparison, I noticed that the Angular 
submodules are slightly different than mine in that there are two files in 
the top level folder that are missing for me. In the scenario where there 
is a top level module named Common and a submodule named Http, the top 
level folder contains a http.d.ts file, and a http.metadata.json file. If I 
copy those files over to my library, and change up the contents to match, 
everything works as it should, and I no longer receive any errors. The 
relevant file contents are listed below:

http.d.ts

export * from './http/http'

http.metadata.json

{
"__symbolic": "module",
"version": 3,
"metadata": {},
"exports": [
{
"from": "./http/http"
}
],
"flatModuleIndexRedirect": true
}

I have tried looking through TSConfig settings and ngc settings to 
determine where these files come from, but I have yet to find anything on 
the subject. Can anyone provide some guidance on how these files are being 
generated?

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to