Next.js Discord

Discord Forum

error - Failed to load next.config.js

Unanswered
Eastern Phoebe posted this in #help-forum
Open in Discord
Eastern PhoebeOP
Hi there, I am new to NextJS and started working in a project but for some reason I cannot execute: npm run build because it fails with the error as in the title. This is how my next.config.js file looks like:
const path = require('path')

const nextConfig = {
    reactStrictMode: true,
    staticPageGenerationTimeOut: 90,
    productionBrowserSourceMaps: true,
    webpack: (config) = {
        config.resolve.alias = {
            ...config.resolve.alias,
            react: path.resolve('./node_modules/react')
            return config
        }
    },
    env: {},
    images: {},
    i18n: {
        locales: ['en'],
        defaultLocale: 'en'
    },
    async headers() {
        return [
            // some headers
        ]
    }
}

module.exports = nextConfig

can I get some help with this issue?
Note: I am running npm 8.19.4 and Node v16.20.0

0 Replies