examples/nextjs-cjs/next.config.mjs
// @ts-check
const trueEnv = ['true', '1', 'yes'];
const NEXTJS_IGNORE_ESLINT = trueEnv.includes(
process.env?.NEXTJS_IGNORE_ESLINT ?? 'false'
);
const NEXTJS_IGNORE_TYPECHECK = trueEnv.includes(
process.env?.NEXTJS_IGNORE_TYPECHECK ?? 'false'
);
const disableSourceMaps = trueEnv.includes(
process.env?.NEXT_DISABLE_SOURCEMAPS ?? 'false'
);
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
productionBrowserSourceMaps: !disableSourceMaps,
typescript: {
tsconfigPath: process.env.TSCONFIG
? process.env.TSCONFIG
: './tsconfig.json',
ignoreBuildErrors: NEXTJS_IGNORE_TYPECHECK,
},
eslint: {
ignoreDuringBuilds: NEXTJS_IGNORE_ESLINT,
dirs: ['src'],
},
experimental: {
// Prefer loading of ES Modules over CommonJS
// @link {https://nextjs.org/blog/next-11-1#es-modules-support|Blog 11.1.0}
// @link {https://github.com/vercel/next.js/discussions/27876|Discussion}
esmExternals: false,
// Experimental monorepo support
// @link {https://github.com/vercel/next.js/pull/22867|Original PR}
// @link {https://github.com/vercel/next.js/discussions/26420|Discussion}
externalDir: true,
},
};
export default nextConfig;