I’m trying to release a production browser build, but running into a problem, which doesn’t seem to be stemming from my own code.
ionic serve works fine, not runtime problems.
ionic cordova build browser --prod completes the production browser build successfully, without any errors or warnings:
ionic cordova build browser --prod Running app-scripts build: --prod --iscordovaserve --externalIpRequired --nobrowser [13:51:54] build prod started ... [13:51:54] clean started ... [13:51:54] clean finished in 6 ms [13:51:54] copy started ... [13:51:54] ngc started ... [13:52:02] ngc finished in 7.70 s [13:52:02] preprocess started ... [13:52:02] deeplinks started ... [13:52:02] deeplinks finished in 270 ms [13:52:02] optimization started ... [13:52:02] copy finished in 8.15 s [13:52:17] optimization finished in 15.37 s [13:52:17] preprocess finished in 15.64 s [13:52:17] webpack started ... [13:53:36] webpack finished in 78.19 s [13:53:36] sass started ... [13:53:36] uglifyjs started ... [13:53:37] sass finished in 1.23 s [13:53:37] cleancss started ... [13:53:39] cleancss finished in 1.89 s [13:53:56] uglifyjs finished in 20.06 s [13:53:56] postprocess started ... [13:53:56] postprocess finished in 48 ms [13:53:56] lint started ... [13:53:56] build prod finished in 121.67 s ✔ Running build - done! / Executing cordova command: cordova build browser [13:54:04] lint finished in 8.28 s ✔ Executing cordova command: cordova build browser - done!
However, when I deploy the
www directory to a web server and run the app, I get:
Uncaught Error: Cannot resolve all parameters for 'PlatformRef_'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'PlatformRef_' is decorated with Injectable. at g (http://localhost/www/build/polyfills.js:3:7133) at noAnnotationError (http://localhost/www/build/main.js:1:10428) at _dependenciesFor (http://localhost/www/build/main.js:1:14098) at resolveReflectiveFactory (http://localhost/www/build/main.js:1:11711) at resolveReflectiveProvider (http://localhost/www/build/main.js:1:12285) at Array.map (native) at resolveReflectiveProviders (http://localhost/www/build/main.js:1:12457) at Function.ReflectiveInjector.resolve (http://localhost/www/build/main.js:4:24489) at Function.ReflectiveInjector.resolveAndCreate (http://localhost/www/build/main.js:4:24642) at http://localhost/www/build/main.js:1:17446 at http://localhost/www/build/main.js:1:17319 at Object.<anonymous> (http://localhost/www/build/main.js:89:23420) at __webpack_require__ (http://localhost/www/build/main.js:1:223) at http://localhost/www/build/main.js:1:988 at http://localhost/www/build/main.js:1:1035
uglifyjs temporary to reveal that the erorr is around
PlatformRef_ and understand that it’s either a circular dependency or incorrect injection flow, but I can’t determine where the problem actually comes from.
Most likely it’s a third-party package incompatibility, but there’s no info to pinpoint which one.