globalize-webpack-plugin
globalize-webpack-plugin copied to clipboard
Cannot read property 'call' of undefined
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?
Please, can you try with https://github.com/globalizejs/globalize/tree/master/examples/app-npm-webpack
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.
Same as https://github.com/rxaviers/globalize-webpack-plugin/issues/73 I believe.
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?
Experiencing this as well. Appears to be a regression introduced in v1.1.2. Will try to dig into it shortly.
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
.
- The syntax for CommonsChunkPlugin has changed
- DedupePlugin is obsolete
- __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
I am also seeing this issue that @chuyler is seeing.
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
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 https://github.com/metaclass-nl/switch-language-example-globalize/issues/2
* configuration in https://github.com/metaclass-nl/globalize/tree/app-npm-webpack4
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...
I have the exact same problem.
Setting production
to false
fixes the problem, but obviously is not the right solution.
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.
it works in development mode, but production
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