-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to package assets in library #10927
Comments
To be clear, there is no recommended way of packaging assets for libraries. |
If the assets were copied to the dist folder just like for the applications (with the possibility to fine-tune the mapping in angular.json), then npm publish would include them in the archive if im not mistaken. It would be up to the developer to specify how they should be arranged by editing the angular.json file. |
Including styles will be nice option too |
There is a workaround posted here: #10869 |
I'll throw this out there as a (non-ideal) workaround that doesn't require gulp. The idea is to use the "root" library component created by the Angular CLI to hold the global styles for the Library. It would have an empty template but with Also, it doesn't have to be the root library component, it can be any component in the library. And this only applies to styles. Images would still have to be inlined. |
Closing as duplicate of #11071 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
A library project cannot specify assets to be packaged in the npm package.
Adding an assets entry in the angular.json produces an error:
Additionally, the json data path is not correctly reported in the error message.
Versions
Repro steps
ng new
ng g library
src/assets
folderangular.json
to include the assets, like in the above example.ng build
.Observed behavior
The above-mentioned error is thrown.
Desired behavior
The assets should be copied in the dist folder, like the applications, and. packaged in the npm module.
Mention any other details that might be useful (optional)
angular applications are able to import assets from npm modules. angular-cli libraries should be able to pack them in the npm module just like the applications.
Shared components may rely on assets to function properly.
The text was updated successfully, but these errors were encountered: