Pages don't have any CSS or JS upon reload or direct link

My site works perfectly locally, with no problems in building or deploy. If I access specific subpages, they’ll work. But if I reload them, there is no CSS or JS found. The console doesn’t log any errors, and the referenced files in the deployed code are blank.

This doesn’t happen with every subpage (some allow direct links), but others just seem to be void of any JS and CSS. Any thoughts?

Node.js 16
React/React DOM 17.0.2
Next.js 12.1.0

Hey @p0w3r_zurg3

Can you share the site, and the specific pages this behaviour is happening on?

Hi @coelmay,

Here are a few examples: (works)
Work @ STEMpump | STEMpump (doesn’t work, only if you navigate from above)
Terms of Service | STEMpump (same as above)
Library | STEMpump (works)

I don’t know what are the similarities between these pages - they all use the same main level components and structures… There are probably more instances of these broken pages, but I don’t know what to look for.

The difference is in the <head>, and the linking of resources such as CSS and JS.

From a working page

And a non-working page

with these errors

It appears the pages that don’t work are using assets that are optimised. Are these pages part of the main site or are they separate sites behind a rewrite?

1 Like

@coelmay you’re awesome!

Disabling the Netlify post-processing/asset optimization fixed it!

I wonder why that was causing problems, but I’m glad it’s solved. Thanks!


Thanks for coming back and letting us know this works! We agree, @coelmay is awesome!!

1 Like