-
Notifications
You must be signed in to change notification settings - Fork 296
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
Ability to configure/add Rollups plugins #1765
Comments
Hi @thomasoreilly, The fact that rollup is used is an implementation detail which can be changed in the future. Also, rollup is used only to generate FESM and UMD bundles, where ESM bundles are generated using NGC directly. Therefore adding any plugins to the pipeline would result in different code in different bundles. I am not sure why you need to replace a value in a library, but typically this indicates that the pattern used is not the recommend one. Any configurations that the library need to work should be provided via dependency injection from the application. |
Thanks for the quick response @alan-agius4. The reason I'm asking for this is because I wanted to be able to conditionally tree shake features from our library via an environment depending set of global toggle-able feature variables. This is something that should happen at build time for the library. We have a solution successfully implemented in our React version of the library that allows us to use Rollup replace plugin to provide the feature toggle variables at build time thus eliminating these features from the final build. I can't think of any other way to achieve this with Angular. |
@thomasoreilly, I don't know the exact setup and architecture of your application and library, but if a library feature is unused in the application, it should be removed from the final bundle out-of-box when the application is built with optimization enabled. |
@alan-agius4, we don't have an application per se, however we do have application developers that use our library. The idea of being able to "turn off" features at build time for the library is so we don't ship said features. |
What features do you want to "turn off"? Do you want some way of removing whole sub-packages or just components, directives and services? |
@SchnWalter, would be nice to "turn off" components but I believe that isn't possible. We provide a UI component library which each UI component declared within its own Angular module. Mostly these modules are independent but can depend on each other. All these modules are export form the public_api file. We are looking to conditionally include parts of components. For example we have a table component and will want to "turn off" some functionality until we are happy it is in a shippable state. |
@SchnWalter we do follow the same approach in the linked repo from #1758 on branch sub-entries. This provides our library in a tree-shakable format. The build time hasn't been an issue for us. I have implemented a way to have two different public_api files, one for dev and the other for prod. This solves exporting modules (UI components) that are ready for shipping. With our React lib we can do something along the lines of. |
This issue has been automatically locked due to inactivity. |
Type of Issue
Description
Is there anyway to add plugins to Rollup?
Looking for a way to configure/add the rollup plugin replace specifically.
Expected Behaviour
Ability to add rollup plugins or configure rollup plugins already in use.
Version Information
Please include all version numbers that might be relevant, e.g. third-party libraries
The text was updated successfully, but these errors were encountered: