forked from masonfox/tome
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
44 lines (41 loc) · 1.22 KB
/
Copy pathnext.config.js
File metadata and controls
44 lines (41 loc) · 1.22 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
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
experimental: {
instrumentationHook: true,
// Skip pre-rendering for pages that fail
workerThreads: false,
cpus: 1,
// Enable optimized package imports for better tree-shaking
optimizePackageImports: ['lucide-react', 'date-fns'],
},
images: {
unoptimized: true, // Required for local file system images
},
// Enable production optimizations
swcMinify: true,
compiler: {
removeConsole: process.env.NODE_ENV === 'production' ? {
exclude: ['error', 'warn'],
} : false,
},
webpack: (config, { isServer, dev }) => {
if (isServer) {
// Externalize bun:sqlite and better-sqlite3 so webpack doesn't try to bundle them
// These are loaded dynamically at runtime based on the environment
config.externals = config.externals || [];
config.externals.push('bun:sqlite');
config.externals.push('better-sqlite3');
}
// Enable better tree-shaking in production
if (!dev) {
config.optimization = {
...config.optimization,
usedExports: true,
sideEffects: false,
};
}
return config;
},
};
module.exports = nextConfig;