Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannor use storage-uploadthing due to ESM compatibility issues #9252

Open
appfresheners opened this issue Nov 16, 2024 · 0 comments
Open

Cannor use storage-uploadthing due to ESM compatibility issues #9252

appfresheners opened this issue Nov 16, 2024 · 0 comments
Labels
invalid-reproduction status: needs-repro If an issue does not include a reproduction

Comments

@appfresheners
Copy link

Describe the Bug

I have followed the steps to add uploadthings as my storage adapter here https://payloadcms.com/docs/upload/storage-adapters

However when i try to build my next.js app. I get this error:
`
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/node_modules/@payloadcms/storage-uploadthing/dist/index.js from /home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/src/payload/payload.config.ts not supported.
Instead change the require of index.js in /home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/src/payload/payload.config.ts to a dynamic import() which is available in all CommonJS modules.
at Object.newLoader [as .js] (/home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/node_modules/pirates/lib/index.js:121:7)
at Object. (/home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/src/payload/payload.config.ts:21:27)
at Module._compile (/home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/node_modules/pirates/lib/index.js:117:24)
at Object.newLoader [as .ts] (/home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/node_modules/pirates/lib/index.js:121:7)
at loadConfig (/home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/node_modules/payload/dist/config/load.js:28:27)
at build (/home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/node_modules/payload/dist/bin/build.js:18:44)
at Object. (/home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/node_modules/payload/dist/bin/index.js:62:21)
at Object. (/home/mthizo/Documents/Workspaces/Frontend-workspace/menorah-store/node_modules/payload/bin.js:2:1) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v20.9.0
`

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/tree/beta/packages/storage-uploadthing

Reproduction Steps

Follow docs to add uploadthings as storage adapter https://payloadcms.com/docs/upload/storage-adapters

Which area(s) are affected? (Select all that apply)

plugin: other

Environment Info

Payload: 2.30.4
nodeJs: 20.9.0
@payloadcms/storage-uploadthing: ^3.0.0-beta.133
@appfresheners appfresheners added status: needs-triage Possible bug which hasn't been reproduced yet v3 validate-reproduction labels Nov 16, 2024
@AlessioGr AlessioGr added status: needs-repro If an issue does not include a reproduction invalid-reproduction labels Nov 16, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Nov 16, 2024
@denolfe denolfe removed the v3 label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid-reproduction status: needs-repro If an issue does not include a reproduction
Projects
None yet
Development

No branches or pull requests

3 participants