Code Monkey home page Code Monkey logo

Comments (7)

DuCanhGH avatar DuCanhGH commented on May 20, 2024 4

@timohausmann no, let's keep it open. Dev mode is supported, and as such, we will need it to work properly. This clearly causes it to not.

from serwist.

DuCanhGH avatar DuCanhGH commented on May 20, 2024 3

@Xardasus if you use installSerwist + runtimeCaching like in basically any Next.js example in the docs, please disable runtimeCaching in development mode:

runtimeCaching: process.env.NODE_ENV === "development" ? undefined : defaultCache,

This feature can cause JS assets to be accidentally outdated, which is not something you want in development mode.

You may also clear the caches just in case.

In Serwist v9, runtimeCaching will be disabled by default in development mode, but this won't be backported to Serwist v8.

Hope this helps!

from serwist.

Xardasus avatar Xardasus commented on May 20, 2024 1

Many thanks @DuCanhGH, looks like it's working

from serwist.

DuCanhGH avatar DuCanhGH commented on May 20, 2024

Yeah this is an age-old issue, but I have not investigated it. Sounds like something is being unexpectedly cached, though.

from serwist.

timohausmann avatar timohausmann commented on May 20, 2024

It seems to only occur in dev, so maybe I could disable the SW in dev if I'm not working on it.

from serwist.

timohausmann avatar timohausmann commented on May 20, 2024

Since Next' preloading etc. behaves differently in dev mode, I found it best to only test the SW in production build.

const withSerwist = require("@serwist/next").default({
    swSrc: "./sw.ts",
    swDest: "public/sw.js",
    disable: process.env.NODE_ENV === 'development',
});

That solves the issue for me, feel free to close.

from serwist.

Xardasus avatar Xardasus commented on May 20, 2024

I get the same issue, also added disable: process.env.NODE_ENV === 'development',
running dev on Next.js 14.1 "dev": "next dev --experimental-https".
Something is getting cached and making it full reload, had to delete caches via the Dev tools.

from serwist.

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.