Comments (8)
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.
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.
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.
@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.
@AlexStefan @martinkr Yep me too
from next-export-i18n.
@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.
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.
v1.3.1
from next-export-i18n.
Related Issues (20)
- Cannot read properties of null (reading 'query') when testing with Jest HOT 3
- How to handle hydration errors? SEO? HOT 8
- Save current language to localstorage instead of url HOT 2
- Support for defaultVariables HOT 1
- Add monorepo support HOT 2
- Support config file, maybe `next-export.config.js` HOT 1
- src folder doesnt work var I18N = require('./../../i18n/index.js'); HOT 1
- When I try building my next.js project using 'yarn build': HOT 2
- Testing with Jest HOT 1
- Remove existing utm strings HOT 1
- Is it possible to select a language using Select with options? HOT 2
- [Question] How to share the translation file with translators HOT 1
- using html tags in nested translation HOT 2
- All pages are statically rendered using the default language HOT 1
- App router migration - Error: NextRouter was not mounted HOT 3
- Accessibility issues with LanguageSwitcher component HOT 1
- Consider taking another approach to improve SEO HOT 1
- [BUG] No types in module for typescript HOT 1
- Not possible to use this library in "type":"module" package
- Generating static pages error when not setting missingSuspenseWithCSRBailout to false HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-export-i18n.