Replies: 1 comment 1 reply
-
Payload requires Payload will run fine without type: module within Next.js, as the Next.js Bundler handles ESM/CJS interop for you. But yea, this will not be the case outside of Next.js, e.g. when running custom scripts. One way to get this to work would be to use a runtime that supports CJS/ESM interop for running the payload scripts. Some options are Bun, Node.js 23 with their new However, I would recommend keeping the "type: module" and finding a way for Next.js to load the babel config. I think if you simply rename it to |
Beta Was this translation helpful? Give feedback.
-
Describe the Bug
I have a use-case where I am running a payload admin panel inside a nextjs project with a babel.config.js as I am using StyleX which does not work with SWC at the moment. Removing type="module" from the package file causes payload commands to fail. But adding it causes nextjs to fail because it cannot import babel.config because internally it uses require to load in custom babel.configs.
Is there a way to get payload commands to run without type='module', or some way to get the project to work with a custom babel.config with type='module'?
Link to the code that reproduces this issue
Any new payload v3 project, remove, type='module', add simple babel.config.js to root.
Reproduction Steps
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Beta Was this translation helpful? Give feedback.
All reactions