chore: fix up withPayload and devnew

This commit is contained in:
Elliot DeNolf
2024-02-28 12:06:58 -05:00
parent 170ae3602b
commit e62cca40ac
4 changed files with 23 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
import type { Metadata } from 'next' import type { Metadata } from 'next'
import type { SanitizedConfig } from 'payload/types' import type { SanitizedConfig } from 'payload/types'
import { payloadFavicon, payloadOgImage } from '@payloadcms/ui' import { payloadFavicon, payloadOgImage } from '@payloadcms/ui/assets'
export const meta = async (args: { export const meta = async (args: {
config: SanitizedConfig config: SanitizedConfig

View File

@@ -1,11 +1,5 @@
const path = require('path')
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const withPayload = (nextConfig = {}) => { const withPayload = (nextConfig = {}) => {
const aliases = {
'payload-config': path.resolve(process.cwd(), process.env.PAYLOAD_CONFIG_PATH),
}
return { return {
...nextConfig, ...nextConfig,
experimental: { experimental: {
@@ -24,13 +18,6 @@ const withPayload = (nextConfig = {}) => {
'pino', 'pino',
'pino-pretty', 'pino-pretty',
], ],
turbo: {
...(nextConfig?.experimental?.turbo || {}),
resolveAlias: {
...(nextConfig?.experimental?.turbo?.resolveAlias || {}),
...aliases,
},
},
}, },
webpack: (webpackConfig, webpackOptions) => { webpack: (webpackConfig, webpackOptions) => {
const incomingWebpackConfig = const incomingWebpackConfig =
@@ -59,7 +46,6 @@ const withPayload = (nextConfig = {}) => {
...(incomingWebpackConfig?.resolve || {}), ...(incomingWebpackConfig?.resolve || {}),
alias: { alias: {
...(incomingWebpackConfig?.resolve?.alias || {}), ...(incomingWebpackConfig?.resolve?.alias || {}),
...aliases,
}, },
fallback: { fallback: {
...(incomingWebpackConfig?.resolve?.fallback || {}), ...(incomingWebpackConfig?.resolve?.fallback || {}),

22
packages/ui/src/@types/assets.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
declare module '*.svg' {
import React = require('react')
export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>
const src: string
export default src
}
declare module '*.jpg' {
const content: string
export default content
}
declare module '*.png' {
const content: string
export default content
}
declare module '*.json' {
const content: string
export default content
}

View File

@@ -7,4 +7,3 @@ export * from './templates'
export * from './graphics' export * from './graphics'
export * from './icons' export * from './icons'
export * from './types' export * from './types'
export * from './assets'