-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
31 lines (27 loc) · 863 Bytes
/
next.config.js
File metadata and controls
31 lines (27 loc) · 863 Bytes
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
/** @type {import('next').NextConfig} */
const enableServerSharp = process.env.ENABLE_SERVER_SHARP === '1';
const nextConfig = {
reactStrictMode: true,
experimental: {
// Keep tesseract.js external on the server to avoid wasm path bundling issues
serverComponentsExternalPackages: [
'tesseract.js',
...(enableServerSharp ? ['sharp'] : []),
],
outputFileTracingIncludes: {
'app/api/recognize-card/route': [
'./node_modules/tesseract.js/dist/worker.min.js',
'./node_modules/tesseract.js/src/worker-script/node/index.js',
'./tessdata/**',
],
},
},
webpack: (config, { dev }) => {
// Use in-memory cache during development to avoid disk pack.gz rename/ENOENT issues
if (dev) {
config.cache = { type: 'memory' };
}
return config;
},
};
module.exports = nextConfig;