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

ReferenceError: module is not defined #57

Closed
ellyxc opened this issue Dec 2, 2022 · 2 comments
Closed

ReferenceError: module is not defined #57

ellyxc opened this issue Dec 2, 2022 · 2 comments

Comments

@ellyxc
Copy link

ellyxc commented Dec 2, 2022

🐛 Bug Report

Using i18next-icu in browser will result ReferenceError: module is not defined error.

To Reproduce

Install i18next and i18next-icu and load in html file like below

npm install i18next i18next-icu

in the html file

<html>
<head>
  <script src="node_modules/i18next/i18next.min.js"></script>
  <script src="node_modules/i18next-icu/i18nextICU.js"></script>
</head>
<body>
  <script>
   i18next
    .use(i18nextICU)
    .init({
        lng: "en",
        resources: {
            en: {
            translation: {
                key:
                "You have {numPhotos, plural, " +
                "=0 {no photos.}" +
                "=1 {one photo.}" +
                "other {# photos.}}"
            }
            }
        }
    });
    i18next.t("key", { numPhotos: 1000 })
  </script>
</body>
</html>

Expected behavior

Javascript above run successfully, instead of returning Uncaught ReferenceError: module is not defined error.

Environment

  • runtime version: chrome browser 107.0.5304.121
  • i18next version: 22.0.6
  • i18next-icu version: 2.0.3
  • os: Mac
@adrai
Copy link
Member

adrai commented Dec 2, 2022

Can you try with v2.1.0 ?

@adrai adrai closed this as completed Dec 4, 2022
@ellyxc
Copy link
Author

ellyxc commented Dec 5, 2022

Can you try with v2.1.0 ?

i just tried and no error anymore. Thank you.

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

2 participants