Home > Blockchain >  Disable to load chunk files via bootstrap script
Disable to load chunk files via bootstrap script

Time:12-21

How to disable dynamic loading chunked css files after making production build in VueJs2?

Problem here

// mini-css-extract-plugin CSS loading
var cssChunks = {"chunk-4f730675":1};
if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);
else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {
promises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) {
var href = "css/"   ({}[chunkId]||chunkId)   "."   {"chunk-4f730675":"ba84c417"}[chunkId]   ".css";
...........
var head = document.getElementsByTagName("head")[0];
                head.appendChild(linkTag);

Because I manually adding paths to all application bundles files, and placed app inside nested directory. Request which called by this script generate the error due wrong path to chunk file.

I just need to remove / disable this dynamic adding this chunk-file link to the header. But how? It's ok to have chunked file, but I don't need to load all this file by script it's already in the header.

CodePudding user response:

Just discovered the problem, actually it's not a problem, just my mistake! If you don't want chunking files, please removed Grouping Components in the Same Chunk in your routes. Don't use (for example):

{
    path: '/login',
    name: 'Login',
    component: () => import('../components/Login.vue'),
  },

Use:

   {
    path: '/login',
    name: 'Login',
    component: Login,
  },

End problems will gone! Thanks for this article https://pocketsun.net/web-development/vuejs-webpack-loading-chunk-files-failed/

  • Related