[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Feedback](/c/feedback/8)

# Default v0-user-next.config.mjs doesnt get applied

95 views · 0 likes · 2 posts


Maximilian Linus Metzner (@linus-getbaito) · 2025-03-26

I want to add a custom next.config.ts to my project but v0 creates a next.config.mjs that doesn't apply my config. The files are created as follows:

```
//v0-user-next.config.mjs
/** @type {import('next').NextConfig} */

const nextConfig = {

  assetPrefix: process.env.ASSET_PREFIX ?? undefined,

}


export default nextConfig
```
And the following next.config.mjs
```
//next.config.mjs
let userConfig = undefined
try {
  userConfig = await import('./v0-user-next.config')
} catch (e) {
  // ignore error
}

/** @type {import('next').NextConfig} */
const nextConfig = {
  eslint: {
    ignoreDuringBuilds: true,
  },
  typescript: {
    ignoreBuildErrors: true,
  },
  images: {
    unoptimized: true,
  },
  experimental: {
    webpackBuildWorker: true,
    parallelServerBuildTraces: true,
    parallelServerCompiles: true,
  },
}

mergeConfig(nextConfig, userConfig)

function mergeConfig(nextConfig, userConfig) {
  if (!userConfig) {
    return
  }

  for (const key in userConfig) {
    if (
      typeof nextConfig[key] === 'object' &&
      !Array.isArray(nextConfig[key])
    ) {
      nextConfig[key] = {
        ...nextConfig[key],
        ...userConfig[key],
      }
    } else {
      nextConfig[key] = userConfig[key]
    }
  }
}

export default nextConfig
```


The resulting nextconfig has the assetPrefix nested in the default path 
```
{
  eslint: {
    ignoreDuringBuilds: true,
  },
  typescript: {
    ignoreBuildErrors: true,
  },
  images: {
    unoptimized: true,
  },
  experimental: {
    webpackBuildWorker: true,
    parallelServerBuildTraces: true,
    parallelServerCompiles: true,
  },
  default: {
    assetPrefix: "/counter-static",
  },
}
```

therefore it doesn't work. 
 
is this something that I am doing wrong or is this a bug in v0?

Btw if I change line 5 in the next.config.mjs it works as intended
```
userConfig = (await import('./v0-user-next.config'))?.default
```


Pauline P. Narvas (@pawlean) · 2025-03-31

Hi, @linus-getbaito! Welcome to the Vercel Community :waving_hand: 

It would be super helpful if you could share the chat with us so we can take a look :smiley: