-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.mjs
More file actions
65 lines (52 loc) · 1.56 KB
/
next.config.mjs
File metadata and controls
65 lines (52 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
/** @type {import('next').NextConfig} */
const config = {
// Only use static export for production builds
...(process.env.NODE_ENV === 'production' && {
output: 'export',
assetPrefix: './',
}),
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
// trailingSlash: true,
// Optional: Prevent automatic `/me` -> `/me/`, instead preserve `href`
// skipTrailingSlashRedirect: true,
// Optional: Change the output directory `out` -> `dist`
// distDir: 'dist',
images: {
unoptimized: true,
},
// TODO remove and fix once for production
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
webpack: (config, { dev }) => {
config.resolve.fallback = {
...config.resolve.fallback,
encoding: fileURLToPath(new URL('encoding', import.meta.url)),
};
// Development-specific optimizations
if (dev) {
// Improve file watching for better cache invalidation
config.watchOptions = {
poll: 1000, // Check for changes every second
aggregateTimeout: 300, // Delay before rebuilding
ignored: /node_modules/, // Don't watch node_modules
};
// Ensure proper cache invalidation
config.cache = {
type: 'filesystem',
buildDependencies: {
config: [__filename],
},
};
}
return config;
},
};
export default config;