kopia lustrzana https://github.com/cheeaun/phanpy
Test Early Hints
rodzic
1582c2508e
commit
5a448e3bf4
|
|
@ -130,6 +130,21 @@ export default defineConfig({
|
|||
]
|
||||
: []),
|
||||
]),
|
||||
{
|
||||
// https://developers.cloudflare.com/pages/configuration/early-hints/
|
||||
name: 'generate-headers',
|
||||
writeBundle(_, bundle) {
|
||||
const cssFiles = Object.keys(bundle).filter((file) =>
|
||||
file.endsWith('.css'),
|
||||
);
|
||||
if (cssFiles.length > 0) {
|
||||
const links = cssFiles
|
||||
.map((file) => ` Link: <${file}>; rel=preload; as=style`)
|
||||
.join('\n');
|
||||
fs.writeFileSync(resolve(__dirname, 'dist/_headers'), `/\n${links}`);
|
||||
}
|
||||
},
|
||||
},
|
||||
VitePWA({
|
||||
manifest: {
|
||||
name: CLIENT_NAME,
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue