-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathnext.config.js
More file actions
88 lines (80 loc) · 2.51 KB
/
next.config.js
File metadata and controls
88 lines (80 loc) · 2.51 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
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*
* Note: We use dynamic import here to avoid blocking Next.js initialization.
* The env validation will happen when the module is actually used, not during config load.
*/
if (!process.env.SKIP_ENV_VALIDATION) {
// Use dynamic import to avoid blocking initialization
import("./src/env.js").catch((err) => {
console.error("Failed to load env validation:", err);
});
}
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
transpilePackages: ["geist", "@meshsdk/react"],
typescript: {
// Warning: This allows production builds to successfully complete even if
// your project has type errors.
ignoreBuildErrors: false,
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "*.blob.vercel-storage.com",
},
{
protocol: "https",
hostname: "*.discordapp.com",
},
{
protocol: "https",
hostname: "ipfs.io",
},
{
protocol: "https",
hostname: "gateway.pinata.cloud",
},
],
// Allow unoptimized images for local proxy API routes
unoptimized: false,
},
// Turbopack configuration (Next.js 16+)
// Empty config silences the warning about webpack/turbopack conflict
// WebAssembly support is enabled by default in Turbopack
turbopack: {},
// Webpack config for builds that explicitly use webpack (e.g., with --webpack flag)
webpack: function (config, options) {
config.experiments = {
asyncWebAssembly: true,
layers: true,
};
// Optimize tree-shaking by ensuring proper module resolution
config.optimization = {
...config.optimization,
usedExports: true,
sideEffects: false,
};
// Handle CommonJS modules that don't support named exports
config.resolve = {
...config.resolve,
extensionAlias: {
".js": [".js", ".ts", ".tsx"],
},
};
return config;
},
// External packages for server components to avoid bundling issues
serverExternalPackages: ["@fabianbormann/cardano-peer-connect"],
};
// Bundle analyzer - only enable when ANALYZE env var is set
/** @type {(config: import("next").NextConfig) => import("next").NextConfig} */
const withBundleAnalyzer = process.env.ANALYZE === 'true'
? require('@next/bundle-analyzer')({
enabled: true,
})
: (config) => config;
export default withBundleAnalyzer(config);