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
[Feature Request] Option to compile in the tslib dependency? #2109
Comments
In general it's not recommended to disable |
Let's take for example a really simple fictional library published on NPM called It only has one simple function
So on the surface of it all, the Angular Package Format seems like a great way to package up this function for use in all sorts of environments, because the BUT hold on. It also builds in Maybe one that does not use the Angular Package Format ... And so if someone with a React environment wants to use |
I think if you are building a “util” library ng-packagr is not the right tool for you. Using esbuild or rollup directly would be a better choice. Using Ng-packagr for such case would cause a bottleneck, because of the number of formats it needs to generate which might not be needed for your case and also the fact the under the hood it uses the Angular compiler to transform TypeScript, CSS and HTML files which in such cases wouldn’t be needed. That being said, I think we can be a bit smart and only include the dependency on tslib when it’s actually being used if this can be done efficiently. |
Ideally 2 things would happen.
It may be that this makes the bundle heavier, but at least now the developer is in control of whether they want to allow this and can make that tradeoff decision themselves ... This removes guess work. Ideally developers should not have to wonder whether ng-packagr is right. It's not just that they have to wonder about this. If they decide that it is right, and start producing packages using it, they still have to upgrade these with a new build, whenever the target environment changes the tslib version requirements. This can be a great deal of additional work. So if they could just package up anything and have confidence that ng-packagr will produce bundles that can be used any just about any environment that would make both the ng-packagr ecosystem and the productivity it affords much more attractive. |
Type of Issue
Description
A feature: please describe your use case and motivation
Right now the
tslib
is added as a direct dependency to Angular Package Format projects.This means that all consumers of the project have to use a
tslib
compatible dependency.It would be great if the required
tslib
lines of code were compiled in directly into the package (Perhaps as an option) so that consumers of the library don't have to worry abouttslib
version compatibility.The text was updated successfully, but these errors were encountered: