-
Notifications
You must be signed in to change notification settings - Fork 20
/
next.config.js
executable file
·48 lines (42 loc) · 1.01 KB
/
next.config.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
/** @type {import('next').NextConfig} */
const withLess = require('next-with-less');
const path = require('path');
const fs = require('fs');
const axios = require('axios');
const nextConfig = {
output: 'export',
images: {
loader: 'akamai',
path: '',
},
};
module.exports = async () => {
const fetchMilvusStats = async () => {
const result = await axios.get(
`${
process.env.MSERVICE_URL || process.env.NEXT_PUBLIC_MSERVICE_URL
}/milvus-stats`
);
return {
pipInstall: result.data.body?.pipInstall || 0,
milvusStars: result.data.body?.milvusStars || 0,
};
};
const result = await fetchMilvusStats();
fs.writeFileSync('./global-stats.json', JSON.stringify(result), 'utf8');
return withLess({
lessLoaderOptions: {
/* ... */
},
...nextConfig,
webpack(config) {
config.resolve.alias['@'] = path.resolve(__dirname, 'src');
return {
...config,
};
},
experimental: {
scrollRestoration: true,
},
});
};