-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.mjs
More file actions
41 lines (37 loc) · 1.13 KB
/
next.config.mjs
File metadata and controls
41 lines (37 loc) · 1.13 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
/** @type {import('next').NextConfig} */
import { fileURLToPath } from "url";
import path from "path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Helper function to resolve module paths
const resolvePath = (modulePath) => {
try {
const pkgPath = path.resolve(__dirname, "node_modules", modulePath);
return pkgPath;
} catch (e) {
console.error(`Failed to resolve ${modulePath}:`, e);
return modulePath;
}
};
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
// Configure compilation for React 19
compiler: {
// Enable new React JSX transform
emotion: false,
styledComponents: true,
reactRemoveProperties: process.env.NODE_ENV === "production",
},
// Ensure React is properly loaded
webpack: (config, { isServer }) => {
// This allows Next.js to find React even with newer versions
config.resolve.alias = {
...config.resolve.alias,
"react/jsx-runtime": resolvePath("react/jsx-runtime"),
"react/jsx-dev-runtime": resolvePath("react/jsx-dev-runtime"),
};
return config;
},
};
export default nextConfig;