In Nextjs it is possible to build to a customized path by setting a distDir in the next config
SST does not respect this setting and actively reads files in a hardcoded .next-folder as seen multiple times in platform/src/components/aws/nextjs.ts
The solution would be to check if that setting is set in the next.config.* and then find the route manifest etc. in the designated distDir instead of the hardcoded .next.
When this is done we're one step closer to be able to have the same Nextjs app deployed multiple times in the same sst.config.ts. Our use case is that we need to deploy the same app twice but a few different environment-variables. If they're ending up in the same distDir build artifacts will leak between them.
Related to opennextjs/opennextjs-aws#1100
In Nextjs it is possible to build to a customized path by setting a distDir in the next config
SST does not respect this setting and actively reads files in a hardcoded
.next-folder as seen multiple times in platform/src/components/aws/nextjs.tsThe solution would be to check if that setting is set in the next.config.* and then find the route manifest etc. in the designated distDir instead of the hardcoded .next.
When this is done we're one step closer to be able to have the same Nextjs app deployed multiple times in the same sst.config.ts. Our use case is that we need to deploy the same app twice but a few different environment-variables. If they're ending up in the same distDir build artifacts will leak between them.
Related to opennextjs/opennextjs-aws#1100