next.config edit
This commit is contained in:
parent
de631457b1
commit
1f857b6d1b
1 changed files with 12 additions and 10 deletions
|
|
@ -2,14 +2,15 @@ import { withPayload } from '@payloadcms/next/withPayload'
|
||||||
import type { NextConfig } from 'next'
|
import type { NextConfig } from 'next'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url)
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
const dirname = path.dirname(__filename)
|
const dirname = path.dirname(__filename)
|
||||||
import { redirects } from './redirects'
|
import { redirects } from './redirects'
|
||||||
|
|
||||||
const NEXT_PUBLIC_SERVER_URL = process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3001'
|
const NEXT_PUBLIC_SERVER_URL = process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3001'
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
|
output: 'standalone',
|
||||||
sassOptions: {
|
sassOptions: {
|
||||||
loadPaths: ['./node_modules/@payloadcms/ui/dist/scss/'],
|
loadPaths: ['./node_modules/@payloadcms/ui/dist/scss/'],
|
||||||
},
|
},
|
||||||
|
|
@ -23,7 +24,7 @@ const nextConfig: NextConfig = {
|
||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
...[NEXT_PUBLIC_SERVER_URL].map((item) => {
|
...[NEXT_PUBLIC_SERVER_URL].map((item) => {
|
||||||
const url = new URL(item)
|
const url = new URL(item)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
hostname: url.hostname,
|
hostname: url.hostname,
|
||||||
protocol: url.protocol.replace(':', '') as 'http' | 'https',
|
protocol: url.protocol.replace(':', '') as 'http' | 'https',
|
||||||
|
|
@ -37,21 +38,22 @@ const nextConfig: NextConfig = {
|
||||||
'.js': ['.ts', '.tsx', '.js', '.jsx'],
|
'.js': ['.ts', '.tsx', '.js', '.jsx'],
|
||||||
'.mjs': ['.mts', '.mjs'],
|
'.mjs': ['.mts', '.mjs'],
|
||||||
}
|
}
|
||||||
|
|
||||||
const replaceHash = (val: unknown) =>
|
const replaceHash = (val: unknown) =>
|
||||||
typeof val === 'string' ? val.replace('[chunkhash]', '[contenthash]') : val
|
typeof val === 'string' ? val.replace('[chunkhash]', '[contenthash]') : val
|
||||||
|
|
||||||
webpackConfig.output.filename = replaceHash(webpackConfig.output.filename)
|
webpackConfig.output.filename = replaceHash(webpackConfig.output.filename)
|
||||||
webpackConfig.output.chunkFilename = replaceHash(webpackConfig.output.chunkFilename)
|
webpackConfig.output.chunkFilename = replaceHash(webpackConfig.output.chunkFilename)
|
||||||
|
|
||||||
return webpackConfig
|
return webpackConfig
|
||||||
},
|
},
|
||||||
|
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
redirects,
|
redirects,
|
||||||
turbopack: {
|
turbopack: {
|
||||||
root: path.resolve(dirname),
|
root: path.resolve(dirname),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withPayload(nextConfig, { devBundleServerPackages: false })
|
export default withPayload(nextConfig, { devBundleServerPackages: false })
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue