#CommonJS Issue with pnpm dev

1 messages · Page 1 of 1 (latest)

tropic jay
#

Hello everyone, I'm really new with Payload CMS and I'm currently trying to fire up Payload 3.0 by creating a new Next.js project with npx create-payload-app.
Problem is that after following the prompts, I try using pnpm dev to fire it up and I end up having the following issue :

`file:///C:/Users/geyma/OneDrive/Documents/Startups/NativeSquare/Projects/oceanink/oceanink-web-2/next.config.mjs:1
import { withPayload } from '@payloadcms/next/withPayload'
^^^^^^^^^^^
SyntaxError: Named export 'withPayload' not found. The requested module '@payloadcms/next/withPayload' is a CommonJS module, which may not support all module.exports as named exports.
SyntaxError: Named export 'withPayload' not found. The requested module '@payloadcms/next/withPayload' is a CommonJS module, which may not support all module.exports as named exports.
support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@payloadcms/next/withPayload';
import pkg from '@payloadcms/next/withPayload';
const { withPayload } = pkg;
const { withPayload } = pkg;`

I understand Payload 3.0 is fully ESM and I've checked that I do have indeed "type"="module" in my package.json. Any insights from the community would be really appreciated 🙂 Let me know if you need more information on my setup.

tropic jay
#

Edit : Never mind ! When checking on VSCode instead of VSCode Insiders, I got the message that pnpm wasn't recognized. After reinstalling it, it works properly !