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

Cannot read property 'call' of undefined #77

Open
paulgrock opened this issue Nov 13, 2017 · 14 comments
Open

Cannot read property 'call' of undefined #77

paulgrock opened this issue Nov 13, 2017 · 14 comments

Comments

@paulgrock
Copy link

I am trying to integrate Globalize via the this webpack plugin and am running into an Cannot read property 'call' of undefined error. It seems like this error happens with the latest version of webpack at least to my limited understanding. I cloned the example app from globalizejs/globalize and updated it here and am getting the same error. I'm not sure if this is a bug or if I've done something wrong. Any idea?

@rxaviers
Copy link
Owner

@paulgrock
Copy link
Author

paulgrock commented Nov 13, 2017

Thanks for the quick response. I tried that and it works but it uses webpack@^1.9.0 and 0.4.x of this plugin. I didn't see anywhere that has an example with the newest version of this plugin.

@loctn
Copy link

loctn commented Nov 13, 2017

Same as #73 I believe.

@jeremyong
Copy link

Also getting this as well. Between this and some of the other issues in this repo, is this plugin still used by users of globalize?

@brymacto
Copy link

Experiencing this as well. Appears to be a regression introduced in v1.1.2. Will try to dig into it shortly.

@chuyler
Copy link

chuyler commented Mar 29, 2018

I'm seeing same issue with globalize/examples/app-npm-webpack-2 example. I had to make some changes to the file webpack-config.js.

  1. The syntax for CommonsChunkPlugin has changed
  2. DedupePlugin is obsolete
  3. __dirname was not defined without specifying node: { __dirname: true}

After all that, node run build succeeds and creates /dist folder. However, navigating to localhost:8080/dist/index.html produces the following error:

Uncaught TypeError: Cannot read property 'call' of undefined
    at t (vendor.74b587537ef92c04abcf.js:1)
    at Object.10 (app.74b587537ef92c04abcf.js:1)
    at t (vendor.74b587537ef92c04abcf.js:1)
    at window.webpackJsonp (vendor.74b587537ef92c04abcf.js:1)
    at app.74b587537ef92c04abcf.js:1

@SteveLillis
Copy link

I am also seeing this issue that @chuyler is seeing.

jou added a commit to jou/globalize-webpack-plugin-bug-77 that referenced this issue Dec 12, 2018
@jou
Copy link

jou commented Dec 12, 2018

I'm also running into this with Webpack 4. I've created a repo with a minimal project that causes this: https://github.com/jou/globalize-webpack-plugin-bug-77

jou added a commit to jou/globalize-webpack-plugin-bug-77 that referenced this issue Dec 12, 2018
@metaclass-nl
Copy link

metaclass-nl commented Feb 5, 2019

I am getting the same error with with Chromium. With Firefox it is 'TypeError: e[n] is undefined*

I also have made a configuration to dynamically switch locale which dynamically loads locale chunks. It works with webpack 3, but with webpack 4 i get 'modules[moduleId] is undefined' in development. In production it becomes 'e[t] is undefined', so i guess it is the same error and modules[moduleId] is more informative.
See metaclass-nl/switch-language-example-globalize#2

* configuration in https://github.com/metaclass-nl/globalize/tree/app-npm-webpack4

@metaclass-nl
Copy link

metaclass-nl commented Feb 6, 2019

With some debugging i found that modules[moduleId] is in a __webpack_require__ function which is defined in the webpackBootstrap section of i18n/en.<hash>.js. modules[moduleId] is undefined with call __webpack_require__(2). Actually only 65, 135, 143, 151 are available in this var modules, these are all defined in in the i18n/en.<hash>.js chunk itself. Module 2 is in vendor.<hash>.js which does not contain a __webpack_require__ function function but just adds its functions to window.webpackJsonp.

Another __webpack_require__ function is defined in main.<hash>.js, but has a different implementation, it loops through window["webpackJsonp"] passing elements to webpackJsonpCallback who adds stuff to modules[moduleId], deferredModules and installedChunks. I wonder if i18n/en.<hash>.js should define its own __webpack_require__ function. Maybe if it just added its functions to window.webpackJsonp, __webpack_require__ from main.<hash>.js would be used and it would take care of adding everything to modules so modules[moduleId] would work. OTOH dynamic loading of aditional locale chunks would then not work i guess, so maybe the implementation of the webpackBootstrap section of each locale chunk should be there, but should be compatible with the one in main.<hash>.js.

But if i take a look at the code of globalize webpack plugin i got no idea how all this could be related to what it does...

@ManuSevenval
Copy link

I have the exact same problem.
Setting production to false fixes the problem, but obviously is not the right solution.

@Darth-Alex
Copy link

ran into the same Problem. as is see, the CommonsChunkPlugin is obsolete and should be replaced with optimization splitChunks. This is how my webpack config looks now: https://gist.github.com/Darth-Alex/181e6efe687d8f029d66672d8ede4414
But didn´t get it running. just seeing a white screen now.

@kun-guo
Copy link

kun-guo commented Feb 12, 2020

image
it works in development mode, but production

@metaclass-nl
Copy link

For a workaround that uses skip-amd-webpack-plugin and cldr instead of the globalize-webpack-plugin, see https://github.com/metaclass-nl/switch-language-example-globalize

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