Next.js Discord

Discord Forum

Standalone build an dynamic basePath in next.config.mjs

Unanswered
Toyger posted this in #help-forum
Open in Discord
ToygerOP
I have a dynamic basePath based on NODE_ENV in my configuration file.
basePath: isProd ? "/public" : undefined,

This is working fine with a non-standalong build using ENV NEXT_PUBLIC_NODE_ENV=production in the Dockerfile but this isn't working for a standalone build.

If I explicitly set the basePath to /public it works as expected.

Is it possible to keep it dynamic with a standalone build? I've tried a few variations but haven't been able to figure it out and searches haven't given me anything.

Thx,

Marty

0 Replies