-
Notifications
You must be signed in to change notification settings - Fork 603
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
Module not found: Error: Cannot resolve module 'cldr/event' #603
Comments
Looks like it was not a Globalize issue but a React kind. globalize-webpack-plugin fixed the problem. |
Globalize modules are wrapped by UMD offering AMD, CJS and global choices. Webpack tries to use AMD (the one that appears first) and can't resolve paths correctly. globalize-webpack-plugin makes webpack to use CJS over AMD in globalize packages, which resolves these paths correctly. I'm glad it's working for you, if you notice any issue feel free to reopen. |
Got the same issue, tried with both react-globalize and react-webpack-globalize, ReactJS compiler returns: `Failed to compile. ./node_modules/globalize/dist/globalize.js |
Hi, @TheDarangel, I faced the same issue, however, the mentioned plugin didn't resolve the issue. But I was able to resolve this issue by manual resolving paths as was suggested in the
My packajes.json also includes the following dependencies related to globalize: I hope, you will find it helpful. |
I have achieved this in the same way by using the following snippet from my webpack config:
This is the first library I have come across in the world of JS today that requires this kind of special configuration. |
Not related to source files, but distribution wrapped by UMD. Please, use https://github.com/rxaviers/skip-amd-webpack-plugin or https://github.com/rxaviers/globalize-webpack-plugin/ in webpack. |
To give you some context: some tools built on top of Webpack (such as Create React App) intentionally don't support adding custom webpack plugins. In part this is exactly because the approach of every other library asking people to add stuff to their configs doesn't really scale for the larger ecosystem. A developer shouldn't need to mess with their configs to just be able to use a library. I know it's frustrating when UMD wrappers mess things up, but maybe you could reconsider this? I don't think Webpack complains about the UMD wrappers generated by e.g. Rollup, so maybe the wrapper itself could be better? |
Thanks for the context. There was no objection to stop supporting AMD in #810 and therefore I'm open to reconsider different distribution that should be released as 2.0. We need someone interested to champion this effort. |
This is unfortunate |
Hi @rxaviers how to use Skip AMD Webpack Plugin?? can you please explain |
Using https://www.npmjs.com/package/globalize-webpack-plugin actually worked for me |
@rxaviers so i'm using a library called as react-flow which somehow requires react-script and it requires webpack 5 to work with storybook, which has forced me to use webpack 5 so due to that i can't really use globalizeplugin since its not compatible with webpack 5 |
webpack returns:
ERROR in ./
/globalize/dist/globalize.js/globalize/dist/globalize.js 22:2-25:14Module not found: Error: Cannot resolve module 'cldr/event' in /home/myapp/node_modules/globalize/dist
@ ./
18 // UMD returnExports
19 if ( typeof define === "function" && define.amd ) {
21 // AMD
22 define([
23 "cldr",
24 "cldr/event"
25 ], factory );
26 } else if ( typeof exports === "object" ) {
event.js is on cldrjs module.
The text was updated successfully, but these errors were encountered: