Error that only occurs when the production flag is set
Please provide us with the following information:
OS?
Chrome Beta 54.0.2840.61, Android 6.0.1
Versions.
angular-cli: 1.0.0-beta.16
node: 4.2.6
os: linux x64
The log given by the failure.
main.8a96c9f….bundle.js:386 Uncaught TypeError: Cannot read property 'parse' of undefined
I have a rather large project that was generated a couple weeks ago with beta.16, and I've just now realized it doesn't work at all on my phone when building with the -prod flag. This doesn't occur when building with the development flag or running ng serve.
When the error occurs, Angular doesn't seem to load at all since I get stuck at the "Loading..." screen, and I can't really debug it as the file is concatenated, minified and all that.
Edit
After further investigation I can conclude that the error has a pretty big chance (about 50/50) to occur after a fresh -prod-build. If it occurs, I can just refresh the site a couple times and it will magically start working without any errors or warnings. Makes me think that there's some race condition coupled with a cache issue.
If I add the --aot-flag it will still have a chance of failing on mobile, but it will produce a different stacktrace that may be of more help.
main.d701279….bundle.js:formatted:14885EXCEPTION: b.b is not a constructort.handleError @ main.d701279….bundle.js:formatted:14885
main.d701279….bundle.js:formatted:14887ORIGINAL STACKTRACE:t.handleError @ main.d701279….bundle.js:formatted:14887
main.d701279….bundle.js:formatted:14888TypeError: b.b is not a constructor
at e.get [as _DomRootRenderer_25] (http://localhost/main.d701279f1b428ae845d4.bundle.js:1460:12227)
at e.get [as _RootRenderer_26] (http://localhost/main.d701279f1b428ae845d4.bundle.js:1460:12528)
at e.get [as _ViewUtils_29] (http://localhost/main.d701279f1b428ae845d4.bundle.js:1460:13158)
at e.getInternal (http://localhost/main.d701279f1b428ae845d4.bundle.js:1460:21435)
at e.get (http://localhost/main.d701279f1b428ae845d4.bundle.js:659:1227)
at t.create (http://localhost/main.d701279f1b428ae845d4.bundle.js:43:2267)
at e.bootstrap (http://localhost/main.d701279f1b428ae845d4.bundle.js:435:4327)
at http://localhost/main.d701279f1b428ae845d4.bundle.js:435:2642
at Array.forEach (native)
at e._moduleDoBootstrap (http://localhost/main.d701279f1b428ae845d4.bundle.js:435:2613)
Well isn't this awkward. After some further testing I realized index.html was cached for 120 seconds in Apache, resulting in index.html pointing to the wrong main- and style-files (because they have a hashed filename). The short expiration time also explains why it would magically work after a "few refreshes".
Glad to hear you got it sorted!
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.