merkle-open / generator-nitro

Your frontend? Fuel it with Nitro! Develop your frontend with a proven but flexible Node.js app, even in a large team.
MIT License
71 stars 28 forks source link

Use hash for CSS chunks #179

Closed topaxi closed 4 years ago

topaxi commented 4 years ago

In our application we had some cache hits on changed files which delivered outdated CSS to our users. Using the a hash instead of the id in the name of the asset should fix this.

I'm not sure if this has any bigger impact on the whole nitro setup though 🙃

ernscht commented 4 years ago

Thanks for your contribution. I see no problem using contenthash for css chunks.

But I'm not sure if this solves your problem. The change is only related to css chunk files. I have never used css chunks in a nitro project before. The webpack configuration should also prevent the extraction of chunks from css or scss files. I would be very interested to know what your setup looks like for this.

topaxi commented 4 years ago

We have a component which lazyloads using the JavaScript import() expression, which generates chunked assets.

function SomeComponent() {
  React.useEffect(() => {
    const { Component } = import('somepackage')
  }, [])
}
ernscht commented 4 years ago

Change was released in version 5.6.11