-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
47 lines (41 loc) · 1.17 KB
/
next.config.js
File metadata and controls
47 lines (41 loc) · 1.17 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
/** @type {import('next').NextConfig} */
const nextConfig = {
// REQUIRED for Cloud Run deployment
output: 'standalone',
// Recommended optimizations
compress: true,
swcMinify: true,
poweredByHeader: false,
reactStrictMode: true,
// Image optimization
images: {
formats: ['image/avif', 'image/webp'],
},
// Exclude native modules from webpack bundle (server-side only)
webpack: (config, { isServer }) => {
if (isServer) {
// Exclude native modules from server-side bundle
config.externals = config.externals || [];
config.externals.push({
'@xenova/transformers': 'commonjs @xenova/transformers',
'onnxruntime-node': 'commonjs onnxruntime-node',
'sharp': 'commonjs sharp',
});
} else {
// Exclude from client-side bundle
config.resolve.fallback = {
...config.resolve.fallback,
'@xenova/transformers': false,
'onnxruntime-node': false,
'sharp': false,
};
}
// Ignore .node files in webpack
config.module.rules.push({
test: /\.node$/,
use: 'ignore-loader',
});
return config;
},
};
module.exports = nextConfig;