Storybook Angular: How to use model / interface from imported custom library?

272 Views Asked by At

so I have an Angular App built in an NX workspace and using custom libraries for each re-useable feature.

I have a lib to store the models for the app. It is built using NX workspace. eg.

nx g @nrwl/workspace:lib dc-models This builds and runs fine using nx serve It has no errors.

When I run storybook eg

nx run dc-featurelib:storybook It builds but it is displaying Warnings in the terminal saying it cannot find the models.

WARNING in ./libs/dc-feature-panel/feature-panel/src/lib/feature-panel/feature-panel.component.ts 33:78-86
"export 'DcPanel' was not found in '@myproject/dc-models'

How do I get this working and remove this warning ??

1

There are 1 best solutions below

0
On BEST ANSWER

@alexff1 solved it.

rm -rf node_modules; then npm install.

After I deleted and re-installed the node modules this fixed the issue.

This was not something I thought of doing as the project has a lot of node modules and takes a long time to install them. Also 'DcPanel' and '@myproject/dc-models' are not imported modules so re-installing node modules never crossed my mind.

But looks like it worked. Thanks.