Files
kami_apple_exchage/frontend/next.config.js
danial 2dfc9de899 refactor(frontend): 优化代码结构和类型定义
- 更新 LinkInfo 类型定义,将 status 字段改为 LinkStatus 类型
- 移除未使用的导入和类型定义
- 优化部分组件的代码结构
- 统一错误处理方式
2025-09-17 18:54:41 +08:00

75 lines
1.6 KiB
JavaScript

/** @type {import('next').NextConfig} */
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const nextConfig = {
// 输出独立可部署的应用
output: 'export',
// 启用严格模式
reactStrictMode: true,
// SPA配置 - 确保所有路由都指向index.html
trailingSlash: true,
// 图像优化配置
images: {
domains: ['localhost'],
formats: ['image/avif', 'image/webp'],
unoptimized: true, // 静态导出需要禁用图像优化
},
// 环境变量
env: {
NEXT_PUBLIC_APP_VERSION: '1.0.0',
},
// 禁用X-Powered-By头
poweredByHeader: false,
// 压缩配置
compress: true,
// Sass配置 - 使用现代 Sass API
sassOptions: {
includePaths: ['./src/styles'],
silenceDeprecations: [
'legacy-js-api',
'import',
'global-builtin',
'mixed-decls',
'slash-div',
'function-units'
],
quietDeps: true,
},
// 优化webpack配置
webpack: (config, { isServer }) => {
// 优化配置
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
}
return config;
},
// Turbopack配置
turbopack: {
rules: {
"*.scss": {
loaders: ["sass-loader"],
as: "*.css",
},
},
},
};
export default nextConfig;