-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
next.config.js
38 lines (34 loc) · 1.1 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
/* eslint-disable @typescript-eslint/no-var-requires */
const withPWA = require('@ducanh2912/next-pwa').default({ dest: 'public' });
const { name: PACKAGE_NAME, version: PACKAGE_VERSION } = require('./package.json');
module.exports = async () => {
const { downloads } = await fetch('https://api.npmjs.org/downloads/point/last-month/mantine-contextmenu')
.then((res) => res.json())
.catch(() => ({ downloads: 0 }));
/**
* @type {import('next').NextConfig}
*/
const config = {
output: 'export',
trailingSlash: true,
images: { unoptimized: true },
experimental: {
typedRoutes: true,
optimizePackageImports: [
'@mantine/code-highlight',
'@mantine/core',
'@mantine/hooks',
'@mantine/notifications',
'@tabler/icons-react',
],
},
env: {
GITHUB_PAGES: String(process.env.GITHUB_PAGES === 'TRUE' || false).toUpperCase(),
PACKAGE_NAME,
PACKAGE_VERSION,
INITIAL_NPM_DOWNLOADS: String(downloads),
},
};
if (process.env.GITHUB_PAGES) config.basePath = '/mantine-contextmenu';
return withPWA(config);
};