sharenet/frontend/next.config.ts
continuist 33e5d8f5d8
Some checks failed
Podman Rootless Demo / test-backend (push) Has been skipped
Podman Rootless Demo / test-frontend (push) Has been skipped
Podman Rootless Demo / build-backend (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Failing after 6m26s
Podman Rootless Demo / deploy-prod (push) Has been skipped
Try to fix issue with WASM init
2025-10-25 23:29:46 -04:00

97 lines
2.1 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
// Performance optimizations
compress: true,
// Enable experimental features for better performance
experimental: {
// Enable optimized package imports
optimizePackageImports: ['lucide-react', '@radix-ui/react-dialog', '@radix-ui/react-label'],
},
// Turbopack configuration (moved from experimental)
turbopack: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
// Webpack optimizations
webpack: (config, { dev, isServer }) => {
// Enable WASM support
config.experiments = {
...config.experiments,
asyncWebAssembly: false,
syncWebAssembly: true,
layers: true,
};
// Configure WASM file handling
config.module = {
...config.module,
rules: [
...(config.module?.rules || []),
{
test: /\.wasm$/,
type: 'webassembly/sync',
},
],
};
// Handle wasm-bindgen runtime imports
config.resolve.fallback = {
...config.resolve.fallback,
wbg: false, // Don't try to resolve 'wbg' imports
};
// Optimize bundle size
if (!dev && !isServer) {
config.optimization = {
...config.optimization,
splitChunks: {
chunks: 'all',
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
};
}
return config;
},
// Image optimization
images: {
formats: ['image/webp', 'image/avif'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
},
// Enable static optimization
trailingSlash: false,
poweredByHeader: false,
// Enable standalone output for Docker
output: 'standalone',
// Compiler optimizations
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
// ESLint configuration
eslint: {
// Don't run ESLint during build for WASM files
ignoreDuringBuilds: true,
},
};
export default nextConfig;