ffcabbar
ffcabbar

Reputation: 371

next.config.js images domains problem with env

I have a problem with the next.config.js images domains.

Here is the next.config.js

module.exports = {
 reactStrictMode: true,

 env: {
  CLIENT_LOCAL_API_URL: '/api',
  CLIENT_API_URL: '/api'
 }, 
 serverRuntimeConfig: {
  SERVER_API_URL: process.env.SERVER_API_URL
 },
 images: {
  domains: [process.env.IMAGE_DOMAIN],
 },
}

Here is the .env file

SERVER_API_URL = api-url
IMAGE_DOMAIN = img-domain

I can't run the app. I get this error after npm run dev:

Specified images.domains should be an Array of strings received invalid values ()

I don't get it where I am doing wrong

Thanks in advance

Upvotes: 3

Views: 2511

Answers (1)

ffcabbar
ffcabbar

Reputation: 371

I fixed it. The env file name was .env.example. I changed to .env.local

Upvotes: 2

Related Questions