-
Notifications
You must be signed in to change notification settings - Fork 12k
Error in ng build --prod that doesn't happen with ng serve --prod #14747
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
Comments
Hi, the problem here is that This works well when not using module type script tags however, it will always fail when using I suggest you file an issue with AWS, that their SDK doesn't work with JS modules. I am going to leave this open for the time being, to discuss this a bit further with the rest of team and see if we should always add |
@alan-agius4 thanks for your great insight, it's perfectly clear. I would advocate for adding type=module on serve because for us we didn't see the problem until the code was merged on our live dev server. |
For readers who encounter this problem in Angular 8 with aws-sdk, a workaround for now it to add these two lines of code in you polyfills.ts file:
|
We discussed this and we decided that it's best that we add |
Thanks @alan-agius4 !!! |
…s when differential loading will be enabled Fixes #14747
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. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
This problem didn't happen with angular/cli 7.x
Description
When I serve the app via
ng serve --prod
the app runs fine.When I serve the files outputted by with a server (apache, nginx)
ng build --prod
the app fails to load with js error.🔬 Minimal Reproduction
Here is a bear-bones repo that exposes the bug: https://github.com/hugodes/cli-2015
🔥 Exception or Error
The problem here is that this errors appears with ng build --prod but not with ng serve --prod
🌍 Your Environment
Anything else relevant?
The error comes from the fact that the aws-sdk is dependent on node specific variables that are not present in a browser context.
But the problem is that the error should both happen with ng serve and ng build.
Why ? Multiple reasons:
The text was updated successfully, but these errors were encountered: