SAM BECKER


Designer and Developer

FEED


@devknoll @timneutkens Reminded me to follow up on this long-running discussion https://t.co/8gUtqWe0eg Is there an official Next.js position on this pattern? https://t.co/bhugFeuPOW
@devknoll @timneutkens From the comments, 'if your concern is calling the server on route change on the client-side, then, you should not use getServerSideProps at all—you should use getInitialProps'
@_ijjk @vercel So is it a matter of importing fs via a different file? How can I safely use it on the server side?
@devknoll @timneutkens Render dynamic content to html on first load for speed/SEO, but then not again should that page be returned to within the same session, i.e, what I believe getServerSideProps does? TLDR; pre-render content for the first page a user views but never again within that session.
@_ijjk @vercel Fascinating! Is there a reason client-side imports are removed when they're USED in getServerSideProps instead of when they're NOT USED in the main component return block? As in, why are imports preserved if they're not used anywhere?
@_ijjk @vercel Make sure to look at the branch called 'public-access'—I posted this repo for a different (but possibly related?) Next.js 12.0.2 bug ...
@_ijjk @vercel Thanks JJ! I can't seem to find a syntax that deploys to @vercel. When I try `import { readFileSync } from 'fs'` I get the following build error `Module not found: Can't resolve 'fs' in '/vercel/path0/pages'` Am I doing it right?
@_ijjk @vercel Oh, I think I just got it. You're saying I can't use fs in `getInitialProps` but can use it in `getServerSideProps`? And presumably in API functions?

CONNECT

TwitterInstagramLinkedInGitHub