Giter Club home page Giter Club logo

Comments (8)

bcjohnblue avatar bcjohnblue commented on May 28, 2024 1

I used i18next translation and face the same problem too. Can anyone provide a tutorial solution ?

from next-pwa.

bcjohnblue avatar bcjohnblue commented on May 28, 2024 1

@shadowwalker Thanks for your example, it can work correctly. By the way, I found setting ignoreRoutes: ['/sw.js', '/workbox-'] of the next-i18next configs can work too.

from next-pwa.

shadowwalker avatar shadowwalker commented on May 28, 2024

@nadjarben I will take a look.

from next-pwa.

shadowwalker avatar shadowwalker commented on May 28, 2024

@nadjarben Hi, how was the sw.js being hosted? If it's behind a redirect, due to security reason, the browser won't allow the service work to run in the background. It must be directly hosted on your server.

from next-pwa.

nadjarben avatar nadjarben commented on May 28, 2024

It used to work in all all my projects, the only difference in this one is that I use i8next translation do you think it could be the reason. It redirect the url to /en /fr ... ?

from next-pwa.

shadowwalker avatar shadowwalker commented on May 28, 2024

Yes, it could be the cause. You need to figure out a way to host it directly from root path, maybe override the route

from next-pwa.

shadowwalker avatar shadowwalker commented on May 28, 2024

@bcjohnblue I can see if I could build a quick example for you.

from next-pwa.

shadowwalker avatar shadowwalker commented on May 28, 2024

@nadjarben @bcjohnblue Hi all, I finally got a working example, please checkout the next-i18next example.
The key lines are here:

await nextI18next.initPromise
// use the i18n middleware for any other routes
server.all('*', nextI18NextMiddleware(nextI18next), (req, res) => {
return handle(req, res)
})

from next-pwa.

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.