forked from gmpetrov/databerry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.base.js
75 lines (70 loc) · 1.76 KB
/
next.config.base.js
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
const path = require('path');
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
reactStrictMode: true,
async redirects() {
return [];
},
async rewrites() {
return [
{
source: '/.well-known/ai-plugin.json',
destination: '/api/openai/plugin/ai-plugin-json',
},
{
source: '/.well-known/openapi.yaml',
destination: '/api/openai/plugin/openapi-yaml',
},
{
source: '/upsert',
destination: '/api/upsert',
},
{
source: '/update',
destination: '/api/update',
},
{
source: '/query/:path*',
destination: '/api/query/:path*',
},
{
source: '/queries',
destination: '/api/query/many',
},
];
},
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.externals.push({
'@huggingface/inference': 'commonjs @huggingface/inference',
replicate: 'commonjs replicate',
'cohere-ai': 'commonjs cohere-ai',
typeorm: 'commonjs typeorm',
'd3-dsv': 'commonjs d3-dsv',
'srt-parser-2': 'commonjs srt-parser-2',
puppeteer: 'commonjs puppeteer',
'html-to-text': 'commonjs html-to-text',
epub2: 'commonjs epub2',
});
if (isServer && config.name === 'server') {
const oldEntry = config.entry;
return {
...config,
async entry(...args) {
const entries = await oldEntry(...args);
return {
...entries,
'worker-datasource-loader': path.resolve(
process.cwd(),
'workers/datasource-loader.ts'
),
};
},
};
}
return config;
},
};
module.exports = nextConfig;