-
Notifications
You must be signed in to change notification settings - Fork 12k
Error with Angular Build Optimizer and ES2015 target #7799
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
What version of typescript is the project using? There is the possibility of some issues with several of the build optimizer passes when used with 2.4+ and es2015+. |
@clydin This was running with TS 2.3.4 |
Found the problem, super calls are being marked as pure:
|
angular/devkit#168 will fix this. |
Will be out in the next release. |
Reopening as @clydin brought up a couple more scenarios where the build optimizer is broken on es2015 input. |
Fixed by angular/devkit#169 |
@filipesilva Still seeing this issue with CLI 1.5.0-rc.0 and Angular 5 RC 2:
On this:
|
@jinder Check the version of build-optimizer in your node_modules
It should be >= 0.0.25 If it's less than 0.0.25, remove |
@prabh-62 Yup, that seems to have done the trick! Thanks. |
@filipesilva This bug reproduce when use angular v6 , cli v6, and rxjs v6.1.0 to build target |
I get the same error as @yokots |
Same issue with Angular 6. I can confirm that it works if targeting ES5. |
Same issue with angular 6, targeting esnext |
Same with latest v6 and es2015 target ` Uncaught ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor` |
Heya, we are aware this is still broken. The current tracking issue for this problem is angular/devkit#816. |
Still seeing his on Angular 6.0.1:
When expanding the obfuscated code, it looks like this: const L = new class extends class { // <--- Why is this "new class extends class" ??????
constructor(e=null) {
this.modifiers = e, // <-- Why is this one okay ? No call to super() !!
e || (this.modifiers = [])
}
hasModifier(e) {
return -1 !== this.modifiers.indexOf(e)
}
}
{
constructor(e, t=null) {
this.name = e // <--- OFFENDING LINE, there is a super() missing!!
}
visitType(e, t) {
return e.visitBuiltinType(this, t)
}
} Had to switch off build-optimizer for the time being. |
Are there scenarios that we need to avoid to not have this issue ? It appeared out of nowhere and we target es6.
|
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 or Feature Request (mark with an
x
)Versions.
macOS
Angular CLI 1.5.0-beta.1
Angular 4.4.3
TS 2.3.4
Repro steps.
In a new cli app set the target to es2015. This works with
ng serve --prod
andng build --prod
. Runng serve --prod --build-optimizer
orng build --prod --build-optimizer
and there will be a runtime error on application start up.From the main bundle
In the compiled class there is on super call on a derived class. When the build optimizer is not used the super call is there. The TS application code has no extended bases classes so I'm guessing its coming from the vendors but unfortunately something is broken with the source mapping for me with es2015 as well.
The text was updated successfully, but these errors were encountered: