🚀 Feature
Currently, the build output looks like:
- ./build/index.html
- ./build/docs/myDoc/index.html
- ./build/someJs.hash.js
- ./build/someCSS.hash.CSS
- ./build/someImage.hash.png
- ./build/someOtherImage.jpeg
Having this flat structure with all file types (hashed or not) melted at the root makes the caching story more complex.
Hashed assets are safe to cache very aggressively, and we should rather move them to a subfolder so that it's easy to enable caching.
For example, aggressive caching can be set by dropping a ./build/_headers config file:
/hashed/*
cache-control: immutable
It is possible to output the webpack JS files in subfolders:
filename: isProd ? 'hashed/js/[name].[contenthash:8].js' : '[name].js',
chunkFilename: isProd
? 'hashed/js/[name].[contenthash:8].js'
: '[name].js',
It should also be possible to achieve with other assets (css, images...).
The files of the /static folder will not be processed by webpack, and not be hashed so they can stay at the root without aggressive caching.
🚀 Feature
Currently, the build output looks like:
Having this flat structure with all file types (hashed or not) melted at the root makes the caching story more complex.
Hashed assets are safe to cache very aggressively, and we should rather move them to a subfolder so that it's easy to enable caching.
For example, aggressive caching can be set by dropping a
./build/_headersconfig file:It is possible to output the webpack JS files in subfolders:
It should also be possible to achieve with other assets (css, images...).
The files of the
/staticfolder will not be processed by webpack, and not be hashed so they can stay at the root without aggressive caching.