summaryrefslogtreecommitdiff
path: root/next.config.js
blob: 12aa2f3ec60d7e07054e777cf4754db35db55606 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/** @type {import('next').NextConfig} */
const withPWA = require('next-pwa')({
  dest: 'public',
  register: true,
  disable: process.env.NODE_ENV === 'development',
  skipWaiting: true
})

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  distDir: process.env.BUILD_DIR || '.next',
  webpack(config) {
    config.module.rules.push({
      test: /\.svg$/i,
      issuer: /\.[jt]sx?$/,
      use: ['@svgr/webpack']
    })

    return config
  },
  i18n: {
    locales: ['id'],
    defaultLocale: 'id'
  },
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'erp.indoteknik.com'
      }
    ]
  },
  async rewrites() {
    return [
      {
        source: '/solr/:path*',
        destination: 'http://34.101.189.218:8983/solr/:path*' // Proxy to Solr
      }
    ]
  },
  async headers() {
    return [
      {
        source: '/solr/:path*',
        headers: [
          { key: 'Access-Control-Allow-Origin', value: '*' },
          { key: 'Access-Control-Allow-Methods', value: 'GET, POST, OPTIONS, PUT, DELETE' },
          { key: 'Access-Control-Allow-Headers', value: '*' }
        ]
      }
    ]
  }
}

module.exports = withPWA(nextConfig)