next.config.mjs 601 B

12345678910111213141516171819202122232425262728293031323334
  1. /** @type {import('next').NextConfig} */
  2. const nextConfig = {
  3. experimental: {
  4. appDir: true,
  5. },
  6. async rewrites() {
  7. const ret = [];
  8. const apiUrl = process.env.API_URL;
  9. if (apiUrl) {
  10. console.log("[Next] using api url ", apiUrl);
  11. ret.push({
  12. source: "/api/:path*",
  13. destination: `${apiUrl}/:path*`,
  14. });
  15. }
  16. return {
  17. afterFiles: ret,
  18. };
  19. },
  20. webpack(config) {
  21. config.module.rules.push({
  22. test: /\.svg$/,
  23. use: ["@svgr/webpack"],
  24. });
  25. return config;
  26. },
  27. output: "standalone",
  28. };
  29. export default nextConfig;