-
Notifications
You must be signed in to change notification settings - Fork 295
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
When building in --watch mode, UMD bundle isn't created, yet still referenced #2023
Comments
This is not something we currently want to do, since UMDs are needed as part of the APF spec. That said, in future UMDs will be dropped completely.
This does look like a nice-to-have, since there shouldn't be any repercussions by this "broken" reference. |
Thank you! Just some background on my specific use case - My library is consumed by a Firebase Cloud-Functions Node project, which shares the same repo. I use this library to share types and utilities between my FE and my BE. When in watch mode, the cloud-function project looks at the BTW, for reasons beyond my comprehension, the Angular app dependent on that very same library works great even without the bundled UMD. But module systems scare me, so I didn't dig too deep into that... |
Typically when using the Angular CLI the UMD bundle is not used. UMD bundles are typically used for legacy behaviour, and in future these will be removed in favour of ES6 modules. I suspect that in your case removing the “main” field would not be enough. |
You are correct! Even without the |
We can probably add an environment variable to opt-out from this behaviour. |
That would be great! I'll be happy to contribute, is there a similar implementation somewhere in the codebase I can use as an example? |
Meanwhile, I've bypassed the problem by skipping It was more complicated that I anticipated, so I detailed the steps and shared them in a Medium article in hope it will help someone else - |
This issue has been automatically locked due to inactivity. |
Type of Issue
Description
while watching a library with
ng build --watch
the UMD bundle isn't created (as evident here, following this commit).Yet, inside the generated
package.json
the"main"
property still refers to the UMD bundle.How To Reproduce
Now check
dist/my-lib/package.json
. You'll notice this line"main": "bundles/my-lib.umd.js"
, while there is actually nobundles
folder generated. (if you drop the--watch
flag the folder IS generated).Expected Behaviour
I expect that if the UMD bundling is skipped (as it is in
--watch
), refrain from pointing to a missing file in the"main"
property of package.json.My even bigger dream is that dropping the UMD bundling will be switchable. If a PR might help, I'll be happy if you could point me in the right direction.
Version Information
The text was updated successfully, but these errors were encountered: