roxiness / routify-starter

https://example.routify.dev/
198 stars 55 forks source link

Consider preserveEntrySignatures: false #54

Closed benmccann closed 4 years ago

benmccann commented 4 years ago

When I visit https://routify.dev/ there are two main.js files. First there's main.js and then it requests main-cd4adf5d.js. This is undesirable for two reasons:

The first main.js file doesn't really do anything. It'd be nicer if these two files were combined into a single file

In the Sapper application template these files would be combined by Rollup because of the preserveEntrySignatures: false option. The Rollup docs say:

This is the recommended setting for web apps where the entry chunks are to be placed in script tags as it may reduce both the number of chunks and possibly the bundle size.

jakobrosenberg commented 4 years ago

Thanks, @benmccann. I was not aware of this feature. I've added it to routify.dev and the starter template.

benmccann commented 4 years ago

Cool! I do see the two files have been combined into one main.js now :smile:

jakobrosenberg commented 4 years ago

It just occurred to me. Would it be even better to skip preserveEntrySignatures and instead import the hashed main-123456.js directly? For those who don't use service workers, the hash might make a difference.

benmccann commented 4 years ago

That would be good too. It would be really nice to hash the main entry point file so that it can be cached by the browser