Next.js expects the config to be either CommonJS (module.exports) or ESM (export default in .mjs files).
Keep your file name as next.config.js and change its content (for export) like this - module.exports = nextConfig;
next.config.js
module.exports = nextConfig;