-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
Error "undefined is not an object (evaluating 'e[c].call')" When runtime chunk is slow to load #634
Comments
Hey @dr3 👋, |
What else you can use?
So the error you can see is the real error - not |
A similar situation I tried to explain in the below comment I think this bug is related to the order of runtime chunk. Currently, I am using the following config in webpack optimization: {
runtimeChunk: false,
}, and is working fine for me. |
@prateekr1 In issue 558, the problem is not completely solved, is it? |
Yeah disabling the runtime chunk meerly avoids the issue. There is still a larger issue. I still wanted to use the runtime chunk. In my project I had to fork |
@yukiyang0729 optimization: {
runtimeChunk: true,
}, |
So, once again - how to replicate? |
@theKashey I am able to reproduce this consistently by slowing down the loading of the runtime chunk. I do this by serving the files via express and using this code to slow the runtime one down app.use('*/runtime~app.*.js', async (req, res, next) => {
await new Promise(resolve => setTimeout(resolve, 5000));
next();
}); |
Is this scheme applied in the project? |
@theKashey hello, can you support this config #526 |
In my fork i changed function assetToScriptTag(asset, extraProps) {
const props = handleExtraProps(asset, extraProps)
const { async, ...rest } = props
return `<script ${async ? 'async' : ''} data-chunk="${asset.chunk}" src="${
asset.url
}"${getSriHtmlAttributes(asset)}${extraPropsToString(asset, rest)}></script>`
} and then use
Obs not ideal, we should try and fix the core issue. But this stopped us getting errors for now |
That strange, as long as |
Hey! I've created an example based on this issue and it's... The async tag definitely is a problem here, and replacing it by defer(still async!) should solve the problem. However - we need to know what exactly is broken to fix this problem once and for all. |
@theKashey I modified the example and it would reproduce the error almost every time. In this example , I have three js files: I may find the reason:
So if script files are loaded by following order, it will cause the error: all the chunks listed in I think it will be solved if we can remove |
Thank you @iwyvi, the problem has been found. Loadable Ready working in a synchronous way :( |
Not fixed until a new version is released. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
* chore(tests): make breaking case for webpack4 * fix: loadableReady should not resolve synchronously, fixes gregberge#634 * chore(size): commit size change
🐛 Bug Report
When the runtime chunk is slow to load,
loadableReady
will run regardless.This causes some errors (depending on the browser)
undefined is not an object (evaluating 'e[c].call')
- Safari & ChromeCannot read property 'call' of undefined
- All browserscan't access property "call", e[c] is undefined
- FirefoxRelated to #558
To Reproduce
Steps to reproduce the behavior:
To replicate this I used express to serve JS bundles, allowing me to simulate it being slow to load
Note, the error only happens after
loadableReady
has completed and the hydration begins. This doesn't happen if you don't useloadableReady
.Expected behavior
loadableReady
continues to wait for the runtime chunk to avoid the errorLink to repl or repo (highly encouraged)
Please provide a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
Run
npx envinfo --system --binaries --npmPackages @loadable/component,@loadable/server,@loadable/webpack-plugin,@loadable/babel-plugin --markdown --clipboard
Paste the results here:
The text was updated successfully, but these errors were encountered: