Recently I began transitioning my personal website from CRA to NextJS and have largely had no issues, but am a bit stuck on this error.
My site has a dynamic background that relies heavily on client-side window properties; given NextJS' SSR defaults I've isolated all references to window size in a single component, and dynamically import it with SSR disabled. I only reference the component in a single place, imported using:
const DynamicBG = dynamic(() => import('./landingSections/FramerBG'), {
ssr: false,
})
The application behaves as expected when ran through npm run dev but refuses to compile through npx next build due to the references to client window size in my code, despite those files being imported with SSR disabled. Am I supposed to differentiate client-rendered components in some way outside dynamic importing?