CoastalCommitsPastes/client/next.config.mjs

41 lines
897 B
JavaScript
Raw Normal View History

2022-03-23 15:34:23 -07:00
import dotenv from "dotenv"
import bundleAnalyzer from "@next/bundle-analyzer"
2022-03-07 23:09:30 -08:00
2022-03-23 15:34:23 -07:00
dotenv.config()
2022-03-21 15:55:21 -07:00
2022-03-06 16:46:59 -08:00
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
experimental: {
outputStandalone: true,
esmExternals: true
},
webpack: (config, { dev, isServer }) => {
if (!dev && !isServer) {
// TODO: enabling Preact causes the file switcher to hang the browser process
// Object.assign(config.resolve.alias, {
// react: "preact/compat",
// "react-dom/test-utils": "preact/test-utils",
// "react-dom": "preact/compat"
// })
}
return config
},
async rewrites() {
return [
{
source: "/server-api/:path*",
destination: `${process.env.API_URL}/:path*`
},
{
source: "/file/raw/:id",
destination: `/api/raw/:id`
}
]
}
2022-03-23 15:34:23 -07:00
}
2022-03-06 16:46:59 -08:00
export default bundleAnalyzer({ enabled: process.env.ANALYZE === "true" })(
nextConfig
2022-03-23 15:34:23 -07:00
)