81 lines
1.8 KiB
JavaScript
81 lines
1.8 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: process.env.VERCEL_ENV === 'production' ? { exclude: ['error'] } : false,
|
|
emotion: true,
|
|
},
|
|
webpack: (config, { isServer }) => {
|
|
config.cache = Object.freeze({
|
|
type: "memory",
|
|
});
|
|
|
|
// if (!isServer) {
|
|
// config.resolve.fallback = {
|
|
// fs: false,
|
|
// };
|
|
// }
|
|
|
|
// config.devServer = {
|
|
// ...config.devServer,
|
|
// proxy: {
|
|
// ...config.devServer.proxy,
|
|
// '/ws': {
|
|
// target: 'ws://116.213.39.234:8083/ws', // WebSocket服务器地址
|
|
// changeOrigin: true,
|
|
// ws: true, // 确保WebSocket连接也被代理
|
|
// },
|
|
// },
|
|
// };
|
|
|
|
|
|
return config;
|
|
},
|
|
eslint: {
|
|
// Warning: This allows production builds to successfully complete even if
|
|
// your project has ESLint errors.
|
|
ignoreDuringBuilds: true,
|
|
},
|
|
experimental: {
|
|
esmExternals: true,
|
|
},
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
protocol: 'https',
|
|
hostname: 'avatars.githubusercontent.com'
|
|
}
|
|
],
|
|
|
|
domains: [
|
|
'qr.alipay.com'
|
|
],
|
|
},
|
|
|
|
sassOptions: {
|
|
includePaths: [path.join(__dirname, 'styles')],
|
|
},
|
|
|
|
|
|
}
|
|
|
|
// module.exports = nextConfig
|
|
module.exports = withBundleAnalyzer({
|
|
enabled: process.env.ANALYZE === 'true',
|
|
})(nextConfig);
|