Files
pawol.nu/next.config.js
T

38 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-10-23 05:22:41 +04:00
const withPWA = require('next-pwa')({
disable: process.env.NODE_ENV !== 'production',
dest: 'public',
register: true,
skipWaiting: true
})
2020-12-23 00:07:21 +01:00
function buildRemotePatterns() {
const raw = process.env.NEXT_PUBLIC_DOMAINS_IMAGE || ''
const patterns = raw.split(' ').filter(Boolean).map(entry => {
const [hostname, port] = entry.split(':')
const isLocal = hostname === 'localhost' || hostname === '127.0.0.1'
const pattern = {protocol: isLocal ? 'http' : 'https', hostname, pathname: '/uploads/**'}
if (port) pattern.port = port
return pattern
})
if (!raw.includes('localhost'))
patterns.push({protocol: 'http', hostname: 'localhost', port: '1337', pathname: '/uploads/**'})
if (!raw.includes('127.0.0.1'))
patterns.push({protocol: 'http', hostname: '127.0.0.1', port: '1337', pathname: '/uploads/**'})
return patterns
}
2026-04-16 12:52:51 +04:00
module.exports = (withPWA({
2026-04-16 22:31:08 +04:00
turbopack: {},
2023-07-14 19:23:08 +04:00
webpack: config => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack', 'url-loader'],
})
return config
2022-10-26 00:31:20 +04:00
},
2022-01-26 07:09:27 +04:00
images: {
remotePatterns: buildRemotePatterns()
2022-01-26 07:09:27 +04:00
}
2022-10-27 06:51:45 +04:00
}))