hts/apps/blogai/next.config.js

56 lines
1.3 KiB
JavaScript

const path = require('path')
const { i18n } = require("./next-i18next.config");
const withBundleAnalyzer = require('@next/bundle-analyzer');
/** @type {import('next').NextConfig} */
const nextConfig = {
// i18n,
reactStrictMode: true,
trailingSlash: true,
swcMinify: true,
cleanDistDir: true,
pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx'],
// pageExtensions: ["tsx", "mdx", "ts", "js"],
productionBrowserSourceMaps: true,
// we're open-source anyways
experimental: {
esmExternals: "loose",
},
compiler: {
removeConsole: false, // 保留所有模式中的 console.log
//removeConsole: process.env.NODE_ENV === 'production' ? { exclude: ['error'] } : false, // ✅ 用 NODE_ENV
emotion: true,
},
webpack: (config, { isServer }) => {
config.cache = Object.freeze({
type: "memory",
});
return config;
},
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com'
}
]
},
sassOptions: {
includePaths: [path.join(__dirname, 'styles')],
},
}
// module.exports = nextConfig
module.exports = withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
})(nextConfig);