Next.js Discord

Discord Forum

How to config stuff in the next.config.mjs file to only work on Production?

Answered
Crème D’Argent posted this in #help-forum
Open in Discord
Crème D’ArgentOP
Yeah.. basically what the title says

My next.config.mjs file:
/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  images: {
    domains: ["..."]
  },
  output: 'export',
  distDir: 'out',
  // Name of your Github project
  basePath: '/animations'
};

export default nextConfig;


I'm trying to make something like this:
basePath: process.env.NODE_ENV != "production" ? "/" : '/animations'
Answered by Crème D’Argent
Oh it does..
View full answer

5 Replies

Crème D’ArgentOP
NextJs version is "14.1.4"
yes process.env.NODE_ENV != "production" ? "/" : '/animations' should just work. have you tried it?
Crème D’ArgentOP
I have not
Does it work the same?
Crème D’ArgentOP
Oh it does..
Answer