filipesilva / angular-quickstart-lib

MIT License
305 stars 75 forks source link

Uncaught Error: Unexpected value 'LibModule' imported by the module 'SharedModule'. Please add a @NgModule annotation. #67

Open idanaim opened 6 years ago

idanaim commented 6 years ago

Uncaught Error: Unexpected value 'LibModule' imported by the module 'SharedModule'. Please add a @NgModule annotation. I get this error when I import the libModule... any solution?

sebelga commented 6 years ago

Are you using anywhere symlinks in your projects? I had something similar with symlinks and had to declare the module/package in my tsconfig.json "paths".

idanaim commented 6 years ago

I don't know what is symlinks.... I just took the library as is change the angular version to ^4.4.6 npm install and npm run build enter to dist library and npm link it and in my app run npm link quickstart-lib and import the the module and compile works well but in the browser I get this problem... any suggestions?

sebelga commented 6 years ago

A symlink is what "npm link" creates on your hard drive. So you could try adding your library in the paths property of your tsconfig.json (in your angular application)

// tsconfig.json
...
"paths": {
    "your-library/*": ["../node_modules/your-library/*"],
}
idanaim commented 6 years ago

Thanks for your'e quick answer but its still doesn't resolve the problem

idanaim commented 6 years ago

forget to answer the solution.... just delete the node_modules from the package

ralberts commented 6 years ago

@idanaim I am curious - What did you do to resolve the issue? You deleted the node_modules in the quickstart and then did an npm install?

idanaim commented 6 years ago

Hey @ralberts no. I run npm install run build and then deleted the node_modules