-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnext.config.mjs
More file actions
57 lines (54 loc) · 2.05 KB
/
Copy pathnext.config.mjs
File metadata and controls
57 lines (54 loc) · 2.05 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
import { fileURLToPath } from 'url'
import path from 'path'
import { codecovNextJSWebpackPlugin } from '@codecov/nextjs-webpack-plugin'
// Pin Turbopack workspace root so multi-lockfile detection (nested worktrees,
// monorepos) doesn't pick the wrong root and skip standalone output.
const __dirname = path.dirname(fileURLToPath(import.meta.url))
/** @type {import('next').NextConfig} */
const nextConfig = {
// Keep production browser source maps off — serving .map files on LAN
// exposes TypeScript source, API route internals, and file paths.
// Use server-side-only source maps + a private error monitor for prod debugging.
productionBrowserSourceMaps: false,
// Standalone output for cross-machine deploys (build on macOS, run on pod).
// Turbopack bakes RELATIVE_ROOT_PATH at build time — without standalone,
// the .next bundle only works on the machine that built it.
output: 'standalone',
// Keep native modules external — resolved from node_modules at runtime
// so the correct platform binary (linux-arm64 on pod) is used.
// hap-nodejs is included because its module-evaluation side effects
// (HAPStorage / mDNS init) crash Next.js's page-data worker with EBADF.
serverExternalPackages: ['better-sqlite3', 'mqtt', 'hap-nodejs'],
turbopack: {
root: __dirname,
// Lingui .po file loader (used in dev mode where Turbopack is active)
rules: {
'*.po': {
loaders: ['@lingui/loader'],
as: '*.js',
},
},
resolveAlias: {
'better-sqlite3': 'better-sqlite3',
},
},
webpack: (config, options) => {
// Lingui .po file loader for webpack builds
config.module.rules.push({
test: /\.po$/,
use: ['@lingui/loader'],
})
config.plugins.push(
codecovNextJSWebpackPlugin({
enableBundleAnalysis: process.env.GITHUB_ACTIONS === 'true',
bundleName: 'sleepypod-core',
oidc: { useGitHubOIDC: true },
gitService: 'github',
webpack: options.webpack,
}),
)
return config
},
reactCompiler: false,
}
export default nextConfig