next.config.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const withLess = require('next-with-less');
  2. const withBundleAnalyzer = require('@next/bundle-analyzer')({
  3. enabled: process.env.ANALYZE === 'true',
  4. });
  5. module.exports = withBundleAnalyzer(
  6. withLess({
  7. productionBrowserSourceMaps: process.env.SOURCE_MAPS === 'true',
  8. trailingSlash: true,
  9. reactStrictMode: true,
  10. images: {
  11. unoptimized: true,
  12. },
  13. swcMinify: true,
  14. webpack(config) {
  15. config.module.rules.push({
  16. test: /\.svg$/i,
  17. issuer: /\.[jt]sx?$/,
  18. use: ['@svgr/webpack'],
  19. });
  20. return config;
  21. },
  22. async rewrites() {
  23. return [
  24. {
  25. source: '/api/:path*',
  26. destination: 'http://localhost:8080/api/:path*', // Proxy to Backend to work around CORS.
  27. },
  28. {
  29. source: '/hls/:path*',
  30. destination: 'http://localhost:8080/hls/:path*', // Proxy to Backend to work around CORS.
  31. },
  32. {
  33. source: '/img/:path*',
  34. destination: 'http://localhost:8080/img/:path*', // Proxy to Backend to work around CORS.
  35. },
  36. {
  37. source: '/logo',
  38. destination: 'http://localhost:8080/logo', // Proxy to Backend to work around CORS.
  39. },
  40. {
  41. source: '/thumbnail.jpg',
  42. destination: 'http://localhost:8080/thumbnail.jpg', // Proxy to Backend to work around CORS.
  43. },
  44. {
  45. source: '/customjavascript',
  46. destination: 'http://localhost:8080/customjavascript', // Proxy to Backend to work around CORS.
  47. },
  48. ];
  49. },
  50. pageExtensions: ['tsx'],
  51. }),
  52. );