Files
penx/next.config.js
2024-08-05 10:06:02 +08:00

60 lines
1.6 KiB
JavaScript

const { env } = require('./server/env')
/**
* @type {import('next').NextConfig}
*/
module.exports = {
experimental: {
serverActions: {
allowedOrigins: ['app.localhost:3000'],
},
},
async rewrites() {
return [
{
source: '/api/trpc/:path*',
destination: `${process.env.NEXT_PUBLIC_API_HOST}/api/trpc/:path*`,
},
]
},
/**
* Dynamic configuration available for the browser and server.
* Note: requires `ssr: true` or a `getInitialProps` in `_app.tsx`
* @link https://nextjs.org/docs/api-reference/next.config.js/runtime-configuration
*/
publicRuntimeConfig: {
NODE_ENV: env.NODE_ENV,
},
transpilePackages: ['react-tweet'],
images: {
remotePatterns: [
{ hostname: 'public.blob.vercel-storage.com' },
{ hostname: '2cil7amusloluyl8.public.blob.vercel-storage.com' },
{ hostname: '*.public.blob.vercel-storage.com' },
{ hostname: 'res.cloudinary.com' },
{ hostname: 'abs.twimg.com' },
{ hostname: 'pbs.twimg.com' },
{ hostname: 'avatar.vercel.sh' },
{ hostname: 'avatars.githubusercontent.com' },
{ hostname: 'www.google.com' },
{ hostname: 'flag.vercel.app' },
{ hostname: 'illustrations.popsy.co' },
],
},
webpack: (config, { isServer }) => {
// https://stackoverflow.com/questions/64926174/module-not-found-cant-resolve-fs-in-next-js-application
config.resolve.fallback = {
fs: false,
net: false,
tls: false,
}
config.externals.push('pino-pretty', 'lokijs', 'encoding', 'bcrypt')
return config
},
}