mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-03-13 10:30:18 +08:00
feat: vercel compatibility
This commit is contained in:
@@ -43,7 +43,7 @@ export const errorHandler: ErrorHandler = (error, ctx) => {
|
||||
});
|
||||
}
|
||||
|
||||
let errorMessage = process.env.NODE_ENV === 'production' ? error.message : error.stack || error.message;
|
||||
let errorMessage = (process.env.NODE_ENV || process.env.VERCEL_ENV) === 'production' ? error.message : error.stack || error.message;
|
||||
switch (error.constructor.name) {
|
||||
case 'HTTPError':
|
||||
case 'RequestError':
|
||||
|
||||
@@ -53,7 +53,7 @@ export type NamespacesType = Record<
|
||||
|
||||
let namespaces: NamespacesType = {};
|
||||
|
||||
switch (process.env.NODE_ENV) {
|
||||
switch (process.env.NODE_ENV || process.env.VERCEL_ENV) {
|
||||
case 'production':
|
||||
namespaces = (await import('../assets/build/routes.js')).default;
|
||||
break;
|
||||
@@ -251,7 +251,7 @@ if (config.debugInfo) {
|
||||
app.use(
|
||||
'/*',
|
||||
serveStatic({
|
||||
root: './lib/assets',
|
||||
root: path.join(__dirname, 'assets'),
|
||||
rewriteRequestPath: (path) => (path === '/favicon.ico' ? '/favicon.png' : path),
|
||||
})
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import winston from 'winston';
|
||||
import { config } from '@/config';
|
||||
|
||||
let transports: (typeof winston.transports.File)[] = [];
|
||||
if (!config.noLogfiles) {
|
||||
if (!config.noLogfiles && !process.env.VERCEL) {
|
||||
transports = [
|
||||
new winston.transports.File({
|
||||
filename: path.resolve('logs/error.log'),
|
||||
|
||||
@@ -7,4 +7,5 @@ export default defineConfig({
|
||||
shims: true,
|
||||
clean: true,
|
||||
plugins: [artTemplatesPlugin()],
|
||||
copy: ['lib/assets'],
|
||||
});
|
||||
|
||||
@@ -7,4 +7,5 @@ export default defineConfig({
|
||||
shims: true,
|
||||
clean: true,
|
||||
plugins: [artTemplatesPlugin()],
|
||||
copy: ['lib/assets'],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user