uiwjs / react-codemirror

CodeMirror 6 component for React. @codemirror https://uiwjs.github.io/react-codemirror/
https://uiwjs.github.io/react-codemirror/
MIT License
1.69k stars 135 forks source link

ERR_REQUIRE_ESM in color extension #540

Open Rahuletto opened 1 year ago

Rahuletto commented 1 year ago

From @uiw/codemirror-extensions-color extension

Error: require() of ES Module /home/Rahuletto/CodeBoard/node_modules/colors-named-hex/lib/index.js from /home/Rahuletto/CodeBoard/node_modules/@uiw/codemirror-extensions-color/cjs/index.js not supported.
Instead change the require of /home/Rahuletto/CodeBoard/node_modules/colors-named-hex/lib/index.js in /home/Rahuletto/CodeBoard/node_modules/@uiw/codemirror-extensions-color/cjs/index.js to a dynamic import() which is available in all CommonJS modules.

I am using NextJS and also import using the dynamic import(). Did i miss something ?

jaywcjlove commented 1 year ago

https://nextjs.org/blog/next-12#es-modules-support-and-url-imports

@Rahuletto

Rahuletto commented 1 year ago

i have enabled it too. Seems like its from colors-named-hex/lib/index.js package in your side of code. I maybe wrong, not sure. Anyways i would love to see custom color picker as native color input has caveats in other browsers like firefox