Closed sahyun1 closed 6 years ago
I am getting the same error when I am trying to build v7-beta using Angular 7 in production mode. Development mode works fine.
Need to dig deeper into this.
yes for now, I'm not including --prod
ionic cordova build android/ios --release
those who just use angular, although I haven't tested, you could try adding --optimizer=false
My preliminary investigation suggests that it is in generated code that is supposed to instantiate RxStompService class.
The issue may be related to this library, Typescript, UglifyJS or Angular.
To narrow down, I will use @stomp/rx-stomp
directly which does not expose Injectables.
In Angular 7, setting "buildOptimizer": false
in configuration for production in angular.json
prevents the issue.
This flag enables optimizations from https://www.npmjs.com/package/@angular-devkit/build-optimizer
The actual issue may be anywhere 😄
Opened an issue with Angular.
I changed the code to use @stomp/rx-stomp; still getting error which disappears with "buildOptimizer": false
. The error is different - related to RxStomp not being a constructor.
This code as a whole has things that Angular's buildOptimizer does not like. 😄
Any progress, except with disabling buildOptimizer ?
I have done further investigation. One side it looks like issue with buidOptimizer (which actually does not remove code but adds some comments, which is used by UglifyJS to remove unused code).
So, something is happening and UglifyJS (controlled by optimization
flag in angular.json) is discarding RxStomp (from @stomp/rx-stomp) considering that to be unused.
I tested the same happens even when this library is getting used in Angular 6 application.
I see following possible solution:
Currently no actionable solution other than switching off buildOptimizer.
Looks like we have a workaround which bypasses issue with buildOptimizer.
For the underlying library @stomp/rx-stomp
, I have changed the default package to be UMD (earlier it was ES2015 modules). With this change it seems to be working.
Please test @stomp/ng2-stompjs@^7.0.0-beta.4
and see if it resolves this issue.
I try with v=7.0.0 and it works, thx
With latest 7.0.0-beta-3
When I build ionic release build like
ionic cordova build android/ios --prod --release
I get blank screen, so I tested it on broswercordova run browser
and gotUncaught TypeError: Object prototype may only be an Object or null: undefined at setPrototypeOf ()
at o (main.e4880d4800aa417f4ee0.js:1)
at main.e4880d4800aa417f4ee0.js:1
at Object.zUnb (main.e4880d4800aa417f4ee0.js:1)
at r (runtime.27839a27ef3fb93b91c1.js:1)
at Object.4 (main.e4880d4800aa417f4ee0.js:1)
at r (runtime.27839a27ef3fb93b91c1.js:1)
at a (runtime.27839a27ef3fb93b91c1.js:1)
at Array.c [as push] (runtime.27839a27ef3fb93b91c1.js:1)
at main.e4880d4800aa417f4ee0.js:1
Since the javascript is not readable due to uglify/minify with
--prod
, I can't track any further but I can confirm that it didn't happen with version 6