Reputation: 4054
I have the simples example:
ng new workspace-test --create-application=false
cd workspace-test
ng generate library lib-test
ng build lib-test
npm link
ng new app-test
npm link lib-test
Error: Module not found: Error: Can't resolve '../../../workspace-test/dist/lib-test/lib/lib-test.component' in 'C:\dev\app-test\src\app'
import { LibTestModule } from '../../../workspace-test/dest/lib-test'
...
imports: [
LibTestModule ,
I don't have idea what is going on, how to make it work? It basic example.
Upvotes: 0
Views: 5605
Reputation: 11
You can install your missing module in node_module folder after building it.
Build your lib:
cd my-lib
ng build
Go to your workspace root:
cd my-workspace
Then install via npm:
npm i ./dist/my-lib
Upvotes: 1
Reputation: 78
if you want to use local library in another local project then your library build should be inside project's node_modules folder
solution change the library build destination to the project's node_modules
assume you have the following folders
go to my-lib>projects>my-lib>ng-package.json
file
change dest to "../../../my-project/node_modules/my-lib"
build your library
Upvotes: 1