Code Monkey home page Code Monkey logo

Comments (4)

fnando avatar fnando commented on July 30, 2024

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.

ricardopacheco avatar ricardopacheco commented on July 30, 2024

@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.

ricardopacheco avatar ricardopacheco commented on July 30, 2024

@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.

fnando avatar fnando commented on July 30, 2024

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)

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.