I want to publish a simple angular library in npmjs. So, the steps i followed was:
Created the project:
ng new my-project
Created the library:
ng g library my-lib
Created a module to the library:
ng g module module1 --project my-lib
Write some code to the module:
Added the library declaration to the public_api.ts file:
export * from './lib/module1/module1.module';
Build and publish the library:
ng build my-lib cd dist/my-lib npm publish
When i test the library locally it works and the library has the exported module.
If i run
npm pack
and then import the library with
npm install --save path/to/my-lib.tgz
in another project, it works and the library has the exported module.
BUT
when i install the library from the npm repo with
npm install --save my-lib
the library download and install was ok but it is like the library was empty, so the desired module is missing and if i try to import the module in the project it fails and i get an error saying that the module doesn't exists.
How can i publish the library with the module or the modules that i want to keep available?