Skip to content
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

BUG: Uncaught (in promise) Error: Loading chunk 0 failed. #5264

Closed
johannes-z opened this issue Jul 11, 2017 · 13 comments
Closed

BUG: Uncaught (in promise) Error: Loading chunk 0 failed. #5264

johannes-z opened this issue Jul 11, 2017 · 13 comments

Comments

@johannes-z
Copy link

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

I'm exporting using the amd libraryTarget. The sources use dynamic imports and my webpack.config.js has multiple entries.

Loading the output entry file works fine, but the file itself loads the fileA.js file, resulting in this error: Uncaught (in promise) Error: Loading chunk 0 failed.

If the current behavior is a bug, please provide the steps to reproduce.

Here is a repo I created which shows the problem: https://github.com/johannes-z/webpack-test

What is the expected behavior?

The url of the script.src is correct (I double checked, opening the file in my browser and it was found).

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

node: v7.7.0
webpack: v3.1.0

@johannes-z
Copy link
Author

johannes-z commented Jul 17, 2017

This only seems to happen, if I add fileA.js to the entry object. Removing it from there resolves the error. Basically, adding it to the entry object added the define call in the emitted file. Removing it from the entry object has no define call. Is this intended?

The reason I explicitly added fileA.js to the entry object was to create the file even if it wasn't required by another source file.

@bigbigbigbear
Copy link

have you resolve this bug?i dont know how to resolve it

@johannes-z
Copy link
Author

You can check what I did in my repo I've posted.

@webpack-bot
Copy link
Contributor

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@antn9x
Copy link

antn9x commented Apr 4, 2018

I resolved by add publicPath: '/', to output in webpack, hope this help.

@alexander-akait
Copy link
Member

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!

@blasterbug
Copy link

Got the same bug, adding publicPath: '/' to output does not fix the problem either.
(webpack@4.11.1)

@montogeek
Copy link
Member

@blasterbug Please open a new issue

@victorhugorch
Copy link

This error maybe can occur because you forgotten or cancel run ionic lab on terminal and try to access any page. Give a look on this.

@IzaGz
Copy link

IzaGz commented Jul 19, 2018

got same error
Uncaught (in promise) Error: Loading chunk SideBarItemsEditing failed. (missing: https://localhost:3000/page/2/js/Cunk-name.js) at HTMLScriptElement.onScriptComplete (app.js:130)
when trying dynamic import with webpackPrefetch
webpack 4.16

@ifelere
Copy link

ifelere commented Jul 27, 2018

For my own case I am using ionic embedded in a web app. The default build paths do not apply. I have an ant script that moves built assets+scripts to web app directory. I just now understood webpack chunks. I just had to tell webpack that my publicPath is different. In my case I use cross-env to pass a process.env. that I need different publicPath (in custom webpack config for ionic) which I set to the root of my web app's public path and it solved my cased (this basically affects build paths that webpack will generate)-- I also made sure I copied the generated chunk files too. So, if you are in a situation like mine this may help.

@pelhage
Copy link

pelhage commented May 21, 2020

Anyone else still having this issue? I am seeing reports of this issue from users but am unable to reproduce. Have confirmed its not a network error though

@blasterbug
Copy link

@pelhage, I do seem that problem occurring sometimes. To me, it seems it is an issue with the worker trying to fetch old chunks after updating the build. It's at least when I see this error happening (in production).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests