-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
75 lines (64 loc) · 1.87 KB
/
next.config.ts
File metadata and controls
75 lines (64 loc) · 1.87 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
66
67
68
69
70
71
72
73
74
75
import type { NextConfig } from "next";
const PATH_BROWSERIFY = "path-browserify";
const EMPTY_SHIM_REL = "./src/lib/shims/empty.js";
const isProd = process.env.NODE_ENV === "production";
const isTauri = process.env.TAURI_ENV_PLATFORM !== undefined;
const nextConfig: NextConfig = {
// Enable static export for Tauri
output: isProd || isTauri ? "export" : undefined,
// Disable image optimization for static export
images: {
unoptimized: true,
},
// Trailing slash for file-based routing in Tauri
trailingSlash: true,
// Performance optimizations
compiler: {
// Remove console.log in production
removeConsole: isProd ? {
exclude: ['error', 'warn'],
} : false,
},
// Turbopack configuration (now top-level in Next.js 16)
turbopack: {
// Resolve aliases for Turbopack (dev)
resolveAlias: {
fs: EMPTY_SHIM_REL,
path: PATH_BROWSERIFY,
module: EMPTY_SHIM_REL,
},
},
// Modern JavaScript optimizations
experimental: {
// Optimize package imports for tree shaking
optimizePackageImports: [
'framer-motion',
'lucide-react',
'react-icons',
'@dnd-kit/core',
'@dnd-kit/sortable',
],
// Enable Turbopack filesystem caching for faster dev startup
turbopackFileSystemCacheForDev: true,
},
webpack: (config, { isServer }) => {
config.resolve = config.resolve || {};
// Only polyfill/alias for client bundles; keep server with real modules.
if (!isServer) {
config.resolve.fallback = {
...(config.resolve.fallback || {}),
fs: false,
path: require.resolve(PATH_BROWSERIFY),
module: false,
};
config.resolve.alias = {
...(config.resolve.alias || {}),
fs: EMPTY_SHIM_REL,
path: PATH_BROWSERIFY,
module: EMPTY_SHIM_REL,
};
}
return config;
},
};
export default nextConfig;