Replies: 2 comments
-
Hey @blobmold. Since payload is a CJS App, you cannot import ESM modules like that - this is intended, as that's the way CJS apps currently work. You do have these options right now:
For payload there are two options:
Both are feature requests rather than issues, so I'm converting this into a discussion. Dual outputting is beyond painful. So, for Payload 3.0, we are looking to switch to ESM! |
Beta Was this translation helpful? Give feedback.
0 replies
-
There is one more thing that I use — sucrase. To run:
To build:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Link to reproduction
No response
Describe the Bug
I am trying to use d3js library to dynamically create svgs. Since d3js supports only ESM modules, I am encountering this error:
importing d3 as
error:
To Reproduce
Create a custom tsx field and import any ES module only library
Should generate the following error:
Payload Version
2.1.1
Adapters and Plugins
bundler-webpack, db-mongodb, plugin-cloud-storage, richtext-slate, payload-swagger
Beta Was this translation helpful? Give feedback.
All reactions