2022-05-02 00:15:13 +08:00
|
|
|
const semi = require('@douyinfe/semi-next').default({});
|
2022-03-12 10:31:03 +08:00
|
|
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
2022-05-20 17:57:05 +08:00
|
|
|
const withPWA = require('next-pwa');
|
2022-03-12 10:31:03 +08:00
|
|
|
const { getConfig } = require('@think/config');
|
2022-03-26 22:02:26 +08:00
|
|
|
const config = getConfig();
|
2022-05-26 14:01:42 +08:00
|
|
|
const pwaRuntimeCaching = require('./pwa-cache');
|
2022-02-20 19:51:55 +08:00
|
|
|
|
2022-05-02 00:15:13 +08:00
|
|
|
/** @type {import('next').NextConfig} */
|
|
|
|
const nextConfig = semi({
|
2022-05-28 15:13:25 +08:00
|
|
|
experimental: {
|
|
|
|
scrollRestoration: true,
|
|
|
|
legacyBrowsers: false,
|
|
|
|
browsersListForSwc: true,
|
|
|
|
},
|
2022-02-20 19:51:55 +08:00
|
|
|
assetPrefix: config.assetPrefix,
|
|
|
|
env: {
|
2022-05-02 00:15:13 +08:00
|
|
|
SERVER_API_URL: config.client.apiUrl,
|
|
|
|
COLLABORATION_API_URL: config.client.collaborationUrl,
|
|
|
|
ENABLE_ALIYUN_OSS: !!config.oss.aliyun.accessKeyId,
|
2022-05-22 10:33:08 +08:00
|
|
|
DNS_PREFETCH: (config.client.dnsPrefetch || '').split(' '),
|
|
|
|
SEO_APPNAME: config.client.seoAppName,
|
|
|
|
SEO_DESCRIPTION: config.client.seoDescription,
|
|
|
|
SEO_KEYWORDS: config.client.seoKeywords,
|
2022-02-20 19:51:55 +08:00
|
|
|
},
|
|
|
|
webpack: (config, { dev, isServer }) => {
|
|
|
|
config.resolve.plugins.push(new TsconfigPathsPlugin());
|
|
|
|
return config;
|
|
|
|
},
|
|
|
|
eslint: {
|
|
|
|
ignoreDuringBuilds: true,
|
|
|
|
},
|
2022-03-21 19:55:06 +08:00
|
|
|
// FIXME: douyinfe 的第三方包存在 ts 类型错误!
|
|
|
|
typescript: {
|
|
|
|
ignoreBuildErrors: true,
|
|
|
|
},
|
2022-05-18 17:04:08 +08:00
|
|
|
compiler: {
|
2022-05-30 15:42:36 +08:00
|
|
|
removeConsole: process.env.NODE_ENV === 'production',
|
2022-05-18 17:04:08 +08:00
|
|
|
},
|
2022-05-20 17:57:05 +08:00
|
|
|
pwa: {
|
|
|
|
disable: process.env.NODE_ENV !== 'production',
|
|
|
|
dest: '.next',
|
|
|
|
sw: 'service-worker.js',
|
2022-05-26 14:01:42 +08:00
|
|
|
runtimeCaching: pwaRuntimeCaching,
|
2022-05-18 16:50:42 +08:00
|
|
|
},
|
2022-02-20 19:51:55 +08:00
|
|
|
});
|
|
|
|
|
2022-05-20 17:57:05 +08:00
|
|
|
module.exports = withPWA(nextConfig);
|