Giter Club home page Giter Club logo

Comments (13)

lukeed avatar lukeed commented on May 22, 2024 2

Correct. Would be the same process and tasks regardless of hash or filename addition

I've been doing this for my projects and preact-starter, haven't run into any issues yet.

from preact-cli.

developit avatar developit commented on May 22, 2024

this would probably break the serviceworker setup since the html has to change in order to update the bundle url, right?

from preact-cli.

lukeed avatar lukeed commented on May 22, 2024

I'm not sure what you mean. The html would be different per build, and would be cached alongside the new build assets too. You'd be looking at fully immutable builds, from version to version.

from preact-cli.

developit avatar developit commented on May 22, 2024

Can't do immutable HTML since that's the entry point - its url has to be /. The issue comes when you're on a page and the SW updates, and then have to reload to get the newest version. Maybe I'm thinking of this wrong?

from preact-cli.

dstaley avatar dstaley commented on May 22, 2024

Correct me if I'm wrong, but if you're not fingerprinting the assets, can't a user find themselves in a situation where their browser has evicted bundle.js from the cache, but not style.css, resulting in a newer version of bundle.js being styled with the previous version of style.css?

from preact-cli.

lukeed avatar lukeed commented on May 22, 2024

Sorry, "immutable" as in all assets. Only the index.html and sw.js filenames will be the same, but their contents always point to new files.

from preact-cli.

lukeed avatar lukeed commented on May 22, 2024

@dstaley right, that's what I'm trying to voice. When assets arent uniformly cached and versioned, you give yourself a window of being caught in between states.

from preact-cli.

developit avatar developit commented on May 22, 2024

html-webpack-plugin has a hash option that appends the compilation hash to assets, which might work for this:
https://github.com/jantimon/html-webpack-plugin#configuration

from preact-cli.

AvraamMavridis avatar AvraamMavridis commented on May 22, 2024

What's the status of this? It would be great if there is an option in the cli to append hash on the bundle.

from preact-cli.

developit avatar developit commented on May 22, 2024

I think the hash-in-querystring approach is doable in the short term.

from preact-cli.

thangngoc89 avatar thangngoc89 commented on May 22, 2024

I have a fork that added hashing the bundle. I'll send a PR

from preact-cli.

lukeed avatar lukeed commented on May 22, 2024

@developit What's your hesitation to adding filename-hashes? I'm not sure, but I don't think that the querystring approach is compatible with even all the servers we offer ootb. Certainly more error-prone in userland with user-setup-servers... perhaps.

from preact-cli.

thangngoc89 avatar thangngoc89 commented on May 22, 2024

@lukeed It's true. I'm having a hard time fighting with nginx and querystring caching

from preact-cli.

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.