-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
ChunkLoadError: Loading chunk 0 failed in Firefox only! #6032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
CLI will inject codes into your lib to overwrite |
the question is, the empty path It seems the output for these lines in the bundle is different in Firefox and Chrome which reassign the path: and Firefox more deeply in Chrome: in Firefox: |
seems to be related to this bug #5247 the problem was my NPM cache, it wasn't installing the library package from my new build. After deleting the node modules folder and install the packages from 0 now it is working in firefox. Thanks |
Got it. This PR fixes the situation where |
hey @fangbinwei can you reopen this again? I see the error is still happening in 1 condition even though it is fixed in prod. I updated my Vue CLI to the last version. When I import the Async components from another Vue Project to another Vue application I see at the beginning it is loading fine and the public path is being resolved correctly but when I navigate to the route that contains an imported it is detecting the first HTML script tag in the DOM as the currentScript, unfortunately, and the issue is coming from this dependency here he mentioned a valid point, and that's my case actually: ref |
Update: I had to build the library of my lazy loading component in a way to set the PublicPath manually by a custom plugin function PublicPathWebpackPlugin() {}
PublicPathWebpackPlugin.prototype.apply = function(compiler) {
compiler.hooks.entryOption.tap('PublicPathWebpackPlugin', (context, entry) => {
if (entry['module.common']) {
entry['module.common'] = path.resolve(__dirname, './src/main.js');
}
if (entry['module.umd']) {
entry['module.umd'] = path.resolve(__dirname, './src/main.js');
}
if (entry['module.umd.min']) {
entry['module.umd.min'] = path.resolve(__dirname, './src/main.js');
}
});
compiler.hooks.beforeRun.tap('PublicPathWebpackPlugin', compiler => {
compiler.options.output.publicPath = ASSET_PATH;
});
};
....
if (process.env.VUE_APP_TARGET === 'component') {
config.plugins.unshift(new PublicPathWebpackPlugin());
} |
Version
4.5.8
Environment info
Steps to reproduce
Making a Library target build with chunks and copy it to another vue project
What is expected?
It should resolve the path of chunks correctly
What is actually happening?
I have a library (made by vue) that is imported to another project. There is a problem with loading the chunks in Mozilla Firefox, I don't know if this is an issue of Mozilla or Webpack because it is working in Chrome (smarter to resolve the path?) without any problem. when it is loading in chrome it uses a wrong path to load the chunk file
By checking the code I see the publicPath is empty in my library

for some reason that I couldn't figure out, the publicPath in Chrome turns to

__webpack_require__.p="https://localhost/"
but in Mozilla Firefox, it shows empty:so it includes the sub route following the
https://localhost/
to load the chunkswhen I manually change the empty
__webpack_require__.p=""
to__webpack_require__.p="/"
it starts working again.The text was updated successfully, but these errors were encountered: