[Vuejs]-Vue-cli compiled app not initializing in certain cases

0👍

I finally resolved this. I cannot give explanation on why those certain lines seemed to work differently and there might be multiple different problems occurring at the same time, but at-least one issue was this:

Basically I stumbled upon this problem once again and this time problem was very similar: Two apps, one shared component, build breaks / doesn’t initialize without errors. By modifying the code certain ways (just as in original post) I was able to get the app to work, and bit later with different mods it once again stopped working. This really threw me off!

I compared working and broken version of source code and noticed that when the shared component was broken it didn’t exist at all in the app.js (such as "customer.js" or "booking.js"). Both working and broken files were identical from the top part, so I compared ’em side by side and noticed this difference:

/******/    deferredModules.push([2,"chunk-vendors"]);
vs
/******/    deferredModules.push([2,"chunk-vendors", "chunk-common"]);

By Googling I discovered what I was suspecting: Common components were separated to chunk-common.js -file. Apparently in some conditions this didn’t occur (thus modifications inside component source either lead to creation of chunk-common or kept the code within the built app.js). Unfortunately when the application didn’t contain necessary files (as they were not imported within HTML-file before creating Vue-instance) it simply silently failed without errors. Really frustrating.

By introducing chunk-common.js before booting up the Vue everything begun to work as intended. I had not collided with this feature on SPA, as SPA doesn’t have multiple entrypoints which would be built to multiple app-builds.

Hopefully this will help someone with the same issue.

Leave a comment