If `experimental.fullySpecified` is set to `true` in the next config, the Payload admin panel fails to compile, throwing the following error: ```ts Failed to compile. ../../node_modules/.pnpm/@payloadcms+next@3.25.0-canary.46647b4_@types+react@18.3.1_graphql@16.10.0_monaco-editor@0.40_w3ro7ziou6gzev7zbe3qqrwaqe/node_modules/@payloadcms/next/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js Attempted import error: 'DiffMethod' is not exported from 'react-diff-viewer-continued' (imported as 'DiffMethod'). ``` The issue stems from incorrect import statements in `react-diff-viewer-continued` 4.0.4. This was fixed in `react-diff-viewer-continued` 4.0.5. This PR also enables `fullySpecified` in our test suites, to catch these issues going forward.
71 lines
1.8 KiB
JavaScript
71 lines
1.8 KiB
JavaScript
import bundleAnalyzer from '@next/bundle-analyzer'
|
|
import { withSentryConfig } from '@sentry/nextjs'
|
|
import { withPayload } from './packages/next/src/withPayload.js'
|
|
import path from 'path'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const dirname = path.dirname(__filename)
|
|
|
|
const withBundleAnalyzer = bundleAnalyzer({
|
|
enabled: process.env.ANALYZE === 'true',
|
|
})
|
|
|
|
const config = withBundleAnalyzer(
|
|
withPayload({
|
|
eslint: {
|
|
ignoreDuringBuilds: true,
|
|
},
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
experimental: {
|
|
fullySpecified: true,
|
|
serverActions: {
|
|
bodySizeLimit: '5mb',
|
|
},
|
|
},
|
|
env: {
|
|
PAYLOAD_CORE_DEV: 'true',
|
|
ROOT_DIR: path.resolve(dirname),
|
|
// @todo remove in 4.0 - will behave like this by default in 4.0
|
|
PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY: 'true',
|
|
},
|
|
async redirects() {
|
|
return [
|
|
{
|
|
destination: '/admin',
|
|
permanent: false,
|
|
source: '/',
|
|
},
|
|
]
|
|
},
|
|
images: {
|
|
domains: ['localhost'],
|
|
},
|
|
webpack: (webpackConfig) => {
|
|
webpackConfig.resolve.extensionAlias = {
|
|
'.cjs': ['.cts', '.cjs'],
|
|
'.js': ['.ts', '.tsx', '.js', '.jsx'],
|
|
'.mjs': ['.mts', '.mjs'],
|
|
}
|
|
|
|
// Ignore sentry warnings when not wrapped with withSentryConfig
|
|
webpackConfig.ignoreWarnings = [
|
|
...(webpackConfig.ignoreWarnings ?? []),
|
|
{ file: /esm\/platform\/node\/instrumentation.js/ },
|
|
{ module: /esm\/platform\/node\/instrumentation.js/ },
|
|
]
|
|
|
|
return webpackConfig
|
|
},
|
|
}),
|
|
)
|
|
|
|
export default process.env.NEXT_PUBLIC_SENTRY_DSN
|
|
? withSentryConfig(config, {
|
|
telemetry: false,
|
|
tunnelRoute: '/monitoring-tunnel',
|
|
})
|
|
: config
|