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
Uncaught TypeError: Cannot read property 'call' of undefined #959
Comments
Is it really a incorrect bundle/chunk file or is the file in the browser cache just old? |
Maybe it's fixed... Please reopen if still an issue with 1.8.4 |
It is really an incorrect bundle/chunk, I've flushed the browser to make sure of that. For instance, using reactjs key mirror, on a list of constants, I'd require('react/lib/keyMirror'). On first build, no problem. On watch build, keyMirror module is completely missing from the file where it used to be. |
I'm still having this issue with 1.8.4. Pretty much the same setup as @kfancy, except my loader is Worth mentioning is that it started happening after upgrading to react 0.13.1. I was porting code from 0.12 and didn't have issues even with webpack 1.7.2. Upgraded react, started having the issue, upgraded webpack to 1.8.4, and the issue still persist. I even removed the CommonsChunckPlugin to see if that would fix the problem, but no luck with that either. I'm also getting random errors like |
I'm still seeing this issue. Using the latest version v1.10.1 First build works fine, but incremental builds fail. I get the following error from my bundle: It seems to break on the usage of function(modules) {
// Check all modules for deduplicated modules
for(var i in modules) {
if(Object.prototype.hasOwnProperty.call(modules, i)) {
switch(typeof modules[i]) {
case "function": break;
case "object":
// Module can be created from a template
modules[i] = (function(_m) {
var args = _m.slice(1), fn = modules[_m[0]];
return function (a,b,c) {
fn.apply(this, [a,b,c].concat(args)); // Breaks here
};
}(modules[i]));
break;
default:
// Module is a copy of another module
modules[i] = modules[modules[i]];
break;
}
}
}
return modules;
} The hashes of the builds are different. |
It has something do with our entry points: We have issues when we use: context: __dirname + '/project_name/static/js',
entry: {
'static/dist/js/app': './components/app.js',
'static/dist/js/log-in': './components/log-in.js',
'static/dist/js/widget-a': './widgets/widget-a.js',
'tests/testBundle': '../../tests/test.js', // removing this line fixes things
},
output: {
path: __dirname + '/project_name',
filename: '[name].js',
sourceMapFileName: '[file].map'
}, When removing PS: Sorry for the strange file system. We should address this once we have the chance. |
@sokra could you re-open this issue? |
Could you try upgrading to the lasted version? |
Done. Still an issue. |
I seem to be having this issue as well. It has been happening for the past few days, not sure if it was a webpack change or a code change that caused this. Let me know if I can help provide any info to track it down. |
😭I'm still seeing this issue. Using the latest version v1.11.0 |
Is there any progress on this issue? |
I'm facing this issue only when I use ExtractTextPlugin + SplitByPathPlugin (or split by name). It goes away if I remove either one of them. |
Same problem here, problem occurs after watch has detected a change and builds the bundle.
v1.11.0 |
Same problem here. Quite difficult to understand exactly how to reproduce the problem, but it seems to happen more frequently when I edit a symlinked module or simply a module inside v1.12.1 |
maybe you have some module in umd factory like this:
maybe umd-require-webpack-plugin will help |
@Jokcy how exactly do you use that plugin with webpack? |
it also happens on v1.12.2. In my case it happens in an entry point which is not included in the However, I do have a few more entry points that are not included in the
and these files have a few jquery stuff with no use of |
CommonsChunkPlugin がバグってるくさい webpack/webpack#959 しょーがないので window に loader ぶっこむ。
I am also having this issue with v1.12.2 For me the issue goes away if I disable the
|
+1 Have same issue when run karma in watch mode. delete webpackConf.entry; |
I have the same problem since I’ve symlinked my To reproduce: git clone git@github.com:parametric-svg/- parametric-svg
cd parametric-svg
git checkout b5a6259b921a48cdef4c010c03ebc56fb593ea01
npm install
cd packages/parse
npm run browser-test |
HMR provided by webpack crashes, with the error: "Uncaught TypeError: Cannot read property 'apply' of undefine" as shown in the following issue on github: webpack/webpack#959 I'm not exactly sure what this issue is, as the cause isn't quite clear to me from reading the bug report. But the latest code changes seemed to have resolved the problem, as all of the root level modules that have side-effects now properly support hot code reloading. This required significant refactoring, and undoubtedly will require yet more. The current issue is that whenever a change is made, a full reload is required, and the only hint of issue is the following error message: "[HMR] Error: Aborted because 125 is not accepted". Checking the file that comes back from webpack indeed shows that 125 is empty. I'm guessing this is some dependency such as freezer, rx, or what have you that is causing the hot reload to fail.
We're seeing this too in our app.
Occassionally it's also Obviously this is only a hunch. I'm at a loss as to how to prove this. It happens sporadically, but probably a couple times per hour. It's also hard to tell if it's a problem with webpack, babel-loader, react-dock (not very likely) or something else. To determine the above, I set the debugger to stop on uncaught exceptions and followed the stack trace down to where react-dock was calling Is anyone experiencing the issue in the same way I am? Or is this just different for everyone? |
The same It breaks on this line in the runtime (I've extract the runtime in a separate chunk, and inserted it into the html):
As @zbyte64 noted, disabling the DedupePlugin plugin fixes the problem. To reproduce:
Then serve the content in the
|
Hey, I'm getting this issue when I try to require textAngular and textAngular-santize. Any ideas on how I can get around it would be much appreciated! |
In my case, I was getting the error because I was attempting to import files already packaged by webpack for production but I didn't package them properly. The "properly" part required that I specify: library: 'someName', // Having a value here is important
libraryTarget: 'umd', |
@apertureless |
My experience: I faced this error 2 times:
fixed by adding
|
This seemed to work for me. The bug occurred to me when using another webpack built UMD library. I confused the target for your solution to be the external webpack file of the library, it isn't, just the regular one in the master project. SIGH time to go home... |
Uncaught (in promise) TypeError: Cannot read property 'call' of undefined - runtime js - on production Browser - Chrome |
If somebody still have problems, please open a new issue with reproducible test repo |
Hi everyone, I just fix this issue by using this webpack.mix.js configuration :
I'm using :
The point to change is at publicPath. So laravel will find the generated chunkFilename from public folder. If we run Laravel on our local PC, we usually use command php artisan serve. And if we want to call a file inside public folder, we don't need to put public on url when you call a file. but at the server we need to put public folder. That's why i set publicPath: '/public/' to tell the laravel that my chunkFilename generated inside public folder I don't need to downgrade my laravel-mix. |
My story with it: webpack.prod.js - bug:
webpack.prod.js - fix:
|
I had the same problem with this error message. I removed a empty style tag in my newly added component that cause the issue:
After that it worked again! |
follow step by step this solution for fix this problem, working with me using webpack 4 1.STEP ONE optimization: {
|
|
never ending.. |
Was able to fix it with a combination of chunk hashing and webpack route prefetching. The prefetching logic prevents the client from requesting outdated chunks, and the chunk hashing forces the chunks to update once new ones are available server side. With only one or the other, chunks either crash or fail to update. I believe this is because we have code splitting implemented in our react appRoot. I would also like to note the often proposed solution of adding My fix: (Webpack 4.46.0 & react 16.14.0 with HtmlWebpackPlugin)
Note: This solution only worked perfectly after the second app update as the prefetching logic must be live on the client to prevent loading outdated chunks. Edit: This did not entirely fix our issue and the problem persists :( |
I also encountered a similar problem in my project. After troubleshooting for a long time, I found that it might be a problem with scope hoisting enabled. Finally, I temporarily solved this problem by commenting out optimization.concatenateModules: true in the wepack configuration |
@Superwzw What is webpack version? |
just clear cache in my case |
Why is this closed? This is still an issue |
I can confirm this is still an issue. I am using webpack 5.30 and vue 2.6.11 I am trying to implement lazy loading on our already existing vue app to reduce our bundle size. Here is how I am importing the component:
The chunk is created successfully, based on this webpack output: When trying to navigate to that route, I keep getting (consistently) the error TypeError: Cannot read property 'call' of undefined A snippet from main.js where the error is thrown:
My webpack configuration:
My package.json
|
Update webpack to the latest version, also please update |
@alexander-akait my webpack version is: |
Can you migrate on webpack v5? |
Today I am facing the same issue: https://stackoverflow.com/questions/70728473/uncaught-typeerror-cannot-read-properties-of-undefined-reading-call-when-up |
I'm having an issue with webpack where if I stop watching and restart, it will build just fine, but if I edit a file and save it, the incremental build fails with this error:
Uncaught TypeError: Cannot read property 'call' of undefined
Hunting it down there's a module that does not get included in the incremental change build. Best guess is the path followed to re-make the bundle file is not being followed correctly. Upon re-running (stop and start), the missing module is included.
webpack.config.js (module names changed to protect the innocent):
The text was updated successfully, but these errors were encountered: