Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support hashing of bundles for cache breaking #2

Open
mattoni opened this issue Mar 20, 2017 · 3 comments
Open

Support hashing of bundles for cache breaking #2

mattoni opened this issue Mar 20, 2017 · 3 comments

Comments

@mattoni
Copy link

mattoni commented Mar 20, 2017

Hi everyone,

So a very common set up is to hash bundles so that the client can cache them, but download new content whenever the bundle is updated ( and therefore will have a new hash ). However, we need to know the names of the files generated in order to serve them properly. I think I saw before that there was support for a hash() method on the "factory", but I may be mistaken.

In order to support this, I propose a hash option be added to a bundle config, with the type of hashing desired.

fuse.bundle("client/app")
    .watch("client/**")
    .hmr()
    .hash("md5")
    .instructions(" > client/index.ts");

then, we need the ability to get the names of bundles created. I was thinking as an async return from run, but if we're in watch-mode that may present some challenges, so I'm not sure the best way to retrieve the generated bundle names. Any input is welcome.

Thanks!

@nchanged
Copy link
Contributor

Great!
hash : option is already in place fuse-box/fuse-box#350

I think run.then could return some meta information, for sure. As it's needed only for production builds, therefore we don't need to care about watching, right?

@mattoni
Copy link
Author

mattoni commented Mar 23, 2017

Maybe, my goal would be to get something like a manifest.json that I can use in my templates to refer to the file name from there without manually programming it in, so getting it in dev mode would be useful as well.

At the end of the day, I want to do client bundle splitting with hashed bundles, so they can be cached on the browser side. but the less separate config for dev vs prod the better.

@nchanged
Copy link
Contributor

We've had some ideas on code splitting. It all comes down to a master bundle right? It is aware of its children.. or slaves.

import("home", module => {})

whereas home is home.e5e5e7h3.js and this information is stored in the primary bundle. So all I am saying is that fusebox should be able to write this information automatically. Correct me if I am wrong here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants