preact-cli-plugin-netlify icon indicating copy to clipboard operation
preact-cli-plugin-netlify copied to clipboard

Inlining home route causes Link rel=preload to be omitted

Open developit opened this issue 7 years ago • 1 comments
trafficstars

Hiya! I use this preact-cli configuration to turn off async component loading for my Home component: https://github.com/developit/oss.ninja/blob/92643be13a90935a93b0c51e4ebf54e24371de1e/preact.config.js#L25-L32

It looks like that messes up this line, which results in the the headers for / being omitted:

/*
	Cache-Control: public, max-age=3600, no-cache
	Access-Control-Max-Age: 600
/sw.js
	Cache-Control: private, no-cache
/*.chunk.*.js
	Cache-Control: public, max-age=31536000
/license
	Link: </style.ec2d7.css>; rel=preload; as=style
	Link: </bundle.e384b.js>; rel=preload; as=script
	Link: </route-license.chunk.b2533.js>; rel=preload; as=script

developit avatar Jan 25 '18 15:01 developit

Hi, Sorry for responding late.

  • I tried to reproduce this with your project (https://github.com/developit/oss.ninja) but I am encountering this error

screen shot 2018-01-30 at 22 17 14

  • So I tried in preact-cli default template with developit/oss.ninja:preact.config.js as config file with this line commented out
 asyncPlugin(config);
  • So by using this lines https://github.com/developit/oss.ninja/blob/92643be13a90935a93b0c51e4ebf54e24371de1e/preact.config.js#L25-L32 we are not getting route-home.chunk.*.js file in webpack plugin's compilation.assets. So below lines of code https://github.com/vinaypuppal/preact-cli-plugin-netlify/blob/79aad2856441563f68fb9250f0a75e125f2ed2f2/index.js#L45-L48 are ignoring headers for /.

  • So what do you suggest, do we need an option to always produce headers for / irrespective of route-home.chunk.*.js being present? Or Should happen by default?

Thanks

vinaypuppal avatar Jan 30 '18 17:01 vinaypuppal