mirror of
https://git.oceanpay.cc/danial/kami_apple_exchage.git
synced 2025-12-18 22:29:09 +00:00
75 lines
1.6 KiB
JavaScript
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; |