builder / next.config.ts
Leon4gr45's picture
Upload folder using huggingface_hub (part 2)
694282a verified
Raw
History Blame Contribute Delete
1.89 kB
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
output: 'standalone',
devIndicators: false,
// Externalize quickjs-emscripten packages to prevent webpack from mangling WASM loading
serverExternalPackages: [
'quickjs-emscripten',
'quickjs-emscripten-core',
'@jitl/quickjs-wasmfile-release-sync',
'esbuild-wasm',
'handlebars',
],
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
// We'll handle TypeScript errors separately
ignoreBuildErrors: false,
},
webpack: (config, { isServer }) => {
config.watchOptions = {
...config.watchOptions,
ignored: ['**/e2e/**', '**/test-results/**', '**/node_modules/**'],
};
if (!isServer) {
config.resolve.alias = {
...config.resolve.alias,
'better-sqlite3': false,
};
// Also exclude native Node.js modules
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
path: false,
crypto: false,
};
}
return config;
},
async headers() {
return [
{
source: '/deployments/:path*',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=3600' },
],
},
];
},
async rewrites() {
return [
// Handle published deployment URLs with standard web server behavior
// /deployments/{projectId}/ -> index.html
{
source: '/deployments/:projectId',
destination: '/deployments/:projectId/index.html',
},
{
source: '/deployments/:projectId/',
destination: '/deployments/:projectId/index.html',
},
// /deployments/{projectId}/page -> page.html (if no extension)
{
source: '/deployments/:projectId/:path([^.]+)',
destination: '/deployments/:projectId/:path.html',
},
];
},
};
export default nextConfig;