Comments (4)
This is likely due to your vike project setup, not i18n-js. Can you please upload a sample project that raises this error?
from i18n-js.
@fnando Of course, it's a pleasure to do so. Here is the repository link: https://github.com/ricardopacheco/vike-18njs-debug
Use nodejs version 20.10.0 (I use Ubuntu 23.10 WSL2 Windows 11 with standard installation using asdf-nodejs);
Observation
Vike uses vitejs and node itself (SSR). I suspect it's the issue of the server with SSR, since I use vitejs in this same version in other SPA projects and i18n-js works perfectly. And coincidentally, I'm using the same version of nodejs (20.10.0) in these other SPA projects. So I believe it's either a configuration bug (some configuration is missing or I need to add something). would it be the path in nodejs?
from i18n-js.
@fnando Good News! I managed to fix the problem (running perfectly on both client and server). From what I understand... the server running nodejs doesn't understand ES6+ syntax and that's why it didn't work. That's right? I don't know that part well. https://github.com/ricardopacheco/vike-18njs-debug/pull/1/files
from i18n-js.
Afaict, node.js can only use import/export statements if you're files have the extension .mjs
. Otherwise, you'd need to do some compiling into something that the regular VM can understand.
https://nodejs.org/api/esm.html
from i18n-js.
Related Issues (20)
- Feature Request: Have the I18nJS.listen call be lazy
- Migration guide does not discuss backends HOT 2
- Bug: HOT 1
- Bug: I18n.t is not a function & I18n is not defined HOT 1
- Bug: multiple locales dir in listen configuration require to specify full path, not relative
- Feature Request:
- Bug: scope and options should be read-only HOT 7
- Bug: `proc` rules should be cleared from exported JSON localization files HOT 1
- Bug: deep sorting for keys missed HOT 2
- Feature Request: Mechanism to specify explicit order of plugins HOT 2
- Bug: overwriting identical exported JSON localization files HOT 2
- Bug: Unable to resolve make-plural HOT 2
- Bug: i18n lint fails when using plugins HOT 3
- Bug: Lint Translations ignoring app config and translations config HOT 3
- Get currently used translation HOT 1
- Feature Request: Support `esmodule` HOT 1
- Bug: While trying to resolve module `make-plural` HOT 1
- Bug: i18n-js is not compatible with Vite HOT 2
- Bug: Failed to load resource node_modules/i18n-js: the server responded with a status of 404 (Not Found)
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 i18n-js.