angular-quickstart-lib
angular-quickstart-lib copied to clipboard
vendor.bundle.js:27884 Uncaught Error: Unexpected value 'MyModule' imported by the module 'AppModule'. Please add a @NgModule annotation
I have created a shared service and it built successfully. But when I tried to import it into my project and it throws error in the browser.
@filipesilva I'm still getting the same error Uncaught Error: Unexpected value 'ShareServiceModule' imported by the module 'AppModule'. Please add a @NgModule annotation.. My shared module is just a service with no ui component.
Shared Service Module
import { ShareService } from './service/share.service';
@NgModule({
declarations: [],
providers: [
ShareService
],
imports: [],
exports: []
})
export class ShareServiceModule { }
Local Module
import { ShareServiceModule} from 'share-service';
@NgModule({
imports: [ShareServiceModule]
})
export class AppModule { }
Having the same problem! Couldn't fine any solution so far
@SebastianSchenk I got it working, make sure you specify your moduleName under rollup:umd If you are running the latest rollup it should be "name": "you-module-name"
any solution for this issue??
The issue for me was that i was updating typescript dependancy from this seed and then i had this issue https://github.com/angular/angular/issues/20146 to give more explanation, ngc (v5) strips completely decorators if used with typescript >= 2.5 so it works fine with AOT coz they are actually not needed but not with JIT one solution that worked for me is to add to your tsconfig "annotationsAs": "decorators" but this is not good because then you re not using tsickle one other solution is to use @angular/tsc-wrapped instead of ngc directly (i think ngc is using tsc-wrapped anyway) that's not good coz the angular team advice against it for some reason the other solution that i went for is that you downgrade Typescript to "typescript": ">=2.4.2 <2.5"
and this is what i actually did
so i think this issue have nothing to do with this repo
I'm having the same error. I was using typescript 2.3.0 but following @hajjem-ayoub 's suggestion I upgraded to 2.4.2. I didn't follow where I should add a name per @playground 's suggestion but I don't think I'm using the umd build.
I ran the build, then npm installed the dist folder to another local repo for testing. That other repo throws this error at runtime.
Feeling rather dejected because the reason I started using the quickstart-lib was because I got the same error when importing raw typescript through a linked repo. I thought it would go away if I imported a built es5 file instead.