-
Notifications
You must be signed in to change notification settings - Fork 585
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
fix: "Maximum call stack size exceeded" error in fast components V2 under minify JS. #4969
Comments
This seems to be an issue with class Foo {
@observable foo: number = 1;
@observable bar: number = 2;
}
const binding = Observable.binding((source: Foo) => source.bar + source.foo);
binding.observe(new Foo(), defaultExecutionContext)
@NgModule({
imports: [BrowserModule, FormsModule],
declarations: [AppComponent],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {} |
This is a bug in Angular 12's code-minification. The from: watcher = void 0;
const prevValue = prev.propertySource[prev.propertyName];
watcher = this; to: (wa = void 0,
wa = this,
e === n.propertySource[n.propertyName] && (this.needsRefresh = !0) In non-minified code, the observable property In the minified code, the watcher is assigned |
Thanks for pushing a fix, even it's a bundle's issue. Appreciated. |
@gf4t47 I've dealt with this exact issue in Stencil and Angular. This is NOT an Angular or Stencil code minifcation bug, but has to do with Terser JS. Terser JS is used in in both Angular and Stencil prod builds, and both of them have configured Terser to use More specifics on the projects: Angular: put in an issue to Angular back at the end of last year - see angular/angular-cli#19705. One of the devs responded clarifying that they are currently trying to open up the Terser config for Angular builds - see angular/angular-cli#15761. Stencil: I noticed that prod builds in Stencil have a hard config for Terser as well. Check out this line - https://github.com/ionic-team/stencil/blob/bf5f197910daab7f822a6e4c56f4f40a81c2ce7e/src/compiler/optimize/optimize-module.ts#L103. We've had to do custom builds in Stencil to get this working, and I have no knowledge of them attempting to open up configuration here. @nicholasrice I really appreciate this fix since it will make our build processes much simpler now. We've been having to work around this for months, so thank you! It's interesting how your fix prevents Terser from doing what it does with |
Thanks for adding that context @tgoze! That makes sense and will be super helpful if this ever regresses in the future. |
# Pull Request ## 🤨 Rationale Updated to fast-element 1.4.1 which includes the following change to work with angular optimized builds: microsoft/fast#4969 Also updates the jasmine-core version which was conflicting with peer dependency resolutions. Regenerated the lockfile for latest versions of listed packages. Fixes #18. ## 👩💻 Implementation See above. ## 🧪 Testing Tested built angular application with optimizations locally in chrome, firefox, and safari. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
🐛 Bug Report
With the new FAST V2 version, loading FAST components with minify JS causes the below error.
Uncaught RangeError: Maximum call stack size exceeded
💻 Repro or Code Sample
https://stackblitz.com/edit/angular-ivy-q9599c?file=src%2Fapp%2Fapp.module.ts
I made an Angular repo here to reproduce the issue. I CAN'T make stackblitz to serve on a production build online.
But if you download that package to local, after npm install:
npx ng serve --configuration=production
would produce the error.npx ng serve --configuration=development
would load FAST components successfully.🤔 Expected Behavior
Be able to load FAST components under minification build.
😯 Current Behavior
Only able to load FAST components without JS minification.
💁 Possible Solution
🔦 Context
We are currently downgrading to FAST V1.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: