I want to build a basic private app behind Auth so it cannot use SSR as the data being used for page render is user-specific. With this, I am going to use “export”=”static” configuration of Next.js so the page is built during the build time, and no Node.js during runtime on the server, just static js files along with other assets.
Now, I want to be able to cache the app js files, while it should be invalidated once a new build is published. So the js file should have a “buildId” randomly generated and the js file should be referenced in the HTML page, every build should generate a new buildId and so update the content of the HTML file.
With this approach, the HTML file cache could be disabled, though it should be a very small file. And the js file which is the real application would be cached until the new deployment.
How achieve this build setup with next.js?