GithubHelp home page GithubHelp logo

Comments (8)

martinkr avatar martinkr commented on June 27, 2024

Hi phola,

thank you for reaching out. I assume "navigator" is not available in your test environment (probably pure node nothing linke jsdom).
Can you tell me more about the tech stack for your CI build? Are you using jest / mocha ?

Cheers!

from next-export-i18n.

phola avatar phola commented on June 27, 2024

just checked and this error happens locally too when a component using this hook is included in https://storybook.js.org/ when building storybook (which uses webpack i believe) . Think you are correct maybe a simple if (typeof window === 'undefined') check would fix?

from next-export-i18n.

martinkr avatar martinkr commented on June 27, 2024

Hi phola,

can you try the file from the issue-branch:
https://github.com/martinkr/next-export-i18n/tree/issue-15/module/dist

In case your CI setup installs all files from the package.json, please add he branch's url instead of the npm-url (https://docs.npmjs.com/cli/v8/configuring-npm/package-json#github-urls)

If everything works out, I'll push a new release, but I don't want to litter npm with "trial versions" ti fix this issue :)

Thank you :)

Cheers!

from next-export-i18n.

AlexStefan avatar AlexStefan commented on June 27, 2024

@martinkr I've overwritten the local index file from node_modules and still getting the same error. This was supposed to fix it?

from next-export-i18n.

XamHans avatar XamHans commented on June 27, 2024

@AlexStefan @martinkr Yep me too

from next-export-i18n.

XamHans avatar XamHans commented on June 27, 2024

@AlexStefan i have overwritten the getDefaultLanguage to this:
const getDefaultLanguage = (userI18n) => { let browserLang; if (navigator) { browserLang = navigator.language.split('-')[0] } if (browserLang && userI18n.translations[browserLang]) { return browserLang; } return userI18n.defaultLang; };

and now it works, i don't know why ? :D

from next-export-i18n.

martinkr avatar martinkr commented on June 27, 2024

Hey,

thank you for testing. This is exaclty what the new code from 1.3.1 is doing as well (Adjusting the check for navigator to be more robust). The issue is propably that your CI environment does not have a complete DOM.

Going to release the new code in a few minutes and going to close the issue afterwards.

Cheers1

from next-export-i18n.

martinkr avatar martinkr commented on June 27, 2024

v1.3.1

from next-export-i18n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.