-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
42 lines (37 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
39
40
41
42
/* eslint-disable @typescript-eslint/no-var-requires */
/** @type {import('next').NextConfig} */
const path = require('path');
const fs = require('fs');
const dotenv = require('dotenv');
const withLess = require('next-with-less');
const withTM = require('next-transpile-modules')([
'@arco-design/web-react',
'@arco-themes/react-arco-pro',
]);
// 加载配置文件 APP_ENV 环境名即后缀名
const envFilePath = path.resolve(__dirname, 'env/.env.' + process.env.APP_ENV);
if (fs.existsSync(envFilePath)) {
dotenv.config({ path: envFilePath });
}
const setting = require('./config/settings.json');
module.exports = withLess(
withTM({
lessLoaderOptions: {
lessOptions: {
modifyVars: {
'arcoblue-6': setting.themeColor,
},
},
},
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
config.resolve.alias['@/assets'] = path.resolve(__dirname, './assets');
config.resolve.alias['@'] = path.resolve(__dirname, './');
return config;
},
pageExtensions: ['tsx'],
})
);