mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-13 19:20:04 +00:00
4fa2ef410f
* ✨ feat(tts): Add tts and stt basic features * ✨ feat(tts): Handle error * 💄 style(tts): Add alert to error handler * 🐛 fix(tts): Error display * ♻️ refactor: refactor the openai initial code to the createBizOpenAI * ♻️ refactor(tts): Refactor header config * ✨ feat: Add TTS voice preview * 🐛 fix(tts): Fix header * 🐛 fix: Fix api --------- Co-authored-by: Arvin Xu <arvinx@foxmail.com>
77 lines
1.7 KiB
JavaScript
77 lines
1.7 KiB
JavaScript
import nextPWA from '@ducanh2912/next-pwa';
|
|
import analyzer from '@next/bundle-analyzer';
|
|
|
|
const isProd = process.env.NODE_ENV === 'production';
|
|
const buildWithDocker = process.env.DOCKER === 'true';
|
|
|
|
const withBundleAnalyzer = analyzer({
|
|
enabled: process.env.ANALYZE === 'true',
|
|
});
|
|
|
|
const withPWA = nextPWA({
|
|
dest: 'public',
|
|
register: true,
|
|
workboxOptions: {
|
|
skipWaiting: true,
|
|
},
|
|
});
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
compress: isProd,
|
|
env: {
|
|
AGENTS_INDEX_URL: process.env.AGENTS_INDEX_URL ?? '',
|
|
PLUGINS_INDEX_URL: process.env.PLUGINS_INDEX_URL ?? '',
|
|
},
|
|
experimental: {
|
|
forceSwcTransforms: true,
|
|
optimizePackageImports: [
|
|
'modern-screenshot',
|
|
'emoji-mart',
|
|
'@emoji-mart/react',
|
|
'@emoji-mart/data',
|
|
'@icons-pack/react-simple-icons',
|
|
'gpt-tokenizer',
|
|
'chroma-js',
|
|
],
|
|
webVitalsAttribution: ['CLS', 'LCP'],
|
|
},
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
hostname: 'registry.npmmirror.com',
|
|
pathname: '/@lobehub/**',
|
|
port: '',
|
|
protocol: 'https',
|
|
},
|
|
],
|
|
unoptimized: !isProd,
|
|
},
|
|
output: buildWithDocker ? 'standalone' : undefined,
|
|
|
|
reactStrictMode: true,
|
|
|
|
transpilePackages: ['antd-style', '@lobehub/ui', '@lobehub/tts'],
|
|
|
|
webpack(config) {
|
|
config.experiments = {
|
|
asyncWebAssembly: true,
|
|
layers: true,
|
|
};
|
|
|
|
// to fix shikiji compile error
|
|
// refs: https://github.com/antfu/shikiji/issues/23
|
|
config.module.rules.push({
|
|
test: /\.m?js$/,
|
|
type: 'javascript/auto',
|
|
resolve: {
|
|
fullySpecified: false,
|
|
},
|
|
});
|
|
|
|
return config;
|
|
},
|
|
};
|
|
|
|
export default isProd ? withBundleAnalyzer(withPWA(nextConfig)) : nextConfig;
|