payloadcms / next-payload

A utility to deploy Payload serverlessly within a Next.js app
308 stars 42 forks source link

Warning Custom CSS file not found at undefined. Next.config.js #84

Closed rafalnawojczyk closed 1 year ago

rafalnawojczyk commented 1 year ago

Link to reproduction

No response

Describe the Bug

When building an app or even trying to start a development server, there is one annoying console.log that looks like that:

Screenshot 2023-10-27 at 09 05 37

It keeps informing me, that I need to specify custom CSS in next.config.js file, and is issued specifically by "withPayload".

Funny part is that when I'm updating a 'cssPath' property in next.config.js file - it is treated as a string. Whatever I put in there - even functions - it is printed exactly the same in console.

Screenshot 2023-10-27 at 09 16 31

When I'm putting a path to CSS file - it is simply telling me that Custom css file not found at "my path to css file".

When rolling back from payload 2.0. to 1.14 - it disappears.

To Reproduce

Simply run npm run dev in Next.js + PayloadCMS project.

Payload Version

2.0.12

Adapters and Plugins

bundler-webpack, db-mongodb, s3Adapter, cloudstorage, seo, redirects,

JarrodMFlesch commented 1 year ago

Hey @rafalnawojczyk I just pushed a fix for this, thanks for bringing it to our attention. If you install the latest @payloadcms/next-payload version the console warning will disappear.

Shmookoff commented 12 months ago

The issue still persists on 0.1.9.

https://github.com/payloadcms/next-payload/blob/main/withPayloadPlugin.js#L9 fs is not defined so it throws a ReferenceError.

This fixes it https://github.com/payloadcms/next-payload/pull/90