-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Locales can't be found on ESM module and CodeSandbox #176
Comments
Hi @Fred2MTL! 👋 The However, I've tried to create an example on CodeSandbox and it's displaying only the Regarding your error, |
I understand 'require' in this context as a loading command specific to the node context, not to the library. Beacause:
So, in my undestanding, it must be resolved at the build time (e.g by rollup) by including the locales directory into the distributed library. Moreover, assuming it forces the locales files to be in this directory, it could not be extended at the design time / the runtime by providing another locales structure. Concerning the storybook point and without deep knowledge, I think the code is run on the server side (e.g. into a node context), explaining the effective load of locales by node, prior to any transformations into Httml / JS, not the client side. Fred |
But the |
Hi @arthurdenner |
I would say that is better if you try to contribute than wait for me :) |
@Fred2MTL, could you provide a reproducible repo with instructions regarding this? It's important for whoever is going to work on it. |
@arthurdenner |
@Fred2MTL, any updates? |
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. |
I think I have the same problem. I am using Meteor with react/semantic-ui. I will check when the project is built if it changes something. |
I was able to reproduce this using Snowpack, but couldn't find a quick solution to the problem without evolving a rewrite of a lot of code since Due to lack of time, I didn't put more work on it so any help and suggestion is appreciated. |
I don't know much on programming node package but could the package use project based json if not found in the package ? |
I am facing the same issue when bundling the module via rollup. I think there are 3 potential solutions around:
If you decide, what you prefer, I could try to contribute a patch |
Submitted PR #664 to resolve this issue |
Hey everyone! I know ESM support is a long-standing issue and there's no direct replace for Option 1 - Accept an object as the
|
Thanks for putting this together. This is still relevant to me and my team. I have no problem going with either approach. Here's my 2 cents: If you plan on refactoring the code properly to get rid of |
@arthurdenner may I propose following what Essentially, users of the dependency have to manually load the locale they want and "register" it. This registration saves the locale object in the browser to later be fetched by anything that needs to be formatted with locales in mind. Since the locale is really just passed down to Another suggestion is to go with option 1, but have
|
Yes, that is still relevant to me! I am still using the 1.x version in my applications and I would love to go to a newer 2.x version if possible. |
@arthurdenner any update? |
Quick fix - just create custom class override with required locale:
|
❔ Question
Hi
I just made the upgrade from the previous version. So, I replace the locale import by a reference to locale into the tag definition (as following):
<SemanticDatepicker selected={oDateRange} type="range" showOutsideDays locale="fr-FR"...>
The build step (based on rollup) runs correctly, but the execution fails with the following error:
ReferenceError: "require is not defined"
More specifically, at:
react-semantic-ui-datepickers.esm.js:1084
.I import a lot of esm files, withount encounter this issue. Moreover, according the rollup configuration, it seems the locales files must be embedded into the distribution files. But, it seems do not be the case.
Has I missed some thing ?
Thanks in advance
Fred
The text was updated successfully, but these errors were encountered: