ealush / emoji-picker-react

The most popular React Emoji Picker
https://ealush.com/emoji-picker-react/
MIT License
1.1k stars 177 forks source link

emoji-picker-react is breaking build #385

Open Ansub opened 11 months ago

Ansub commented 11 months ago

getting this error

`Error [ERR_REQUIRE_ESM]: require() of ES Module /speedy-app/node_modules/flairup/dist/index.js from /speedy-app/node_modules/emoji-picker-react/dist/emoji-picker-react.cjs.production.min.js not supported. index.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /speedy-app/node_modules/flairup/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

at Object.<anonymous> (/speedy-app/node_modules/emoji-picker-react/dist/emoji-picker-react.cjs.production.min.js:1:153)
at Object.<anonymous> (/speedy-app/node_modules/emoji-picker-react/dist/index.js:5:20)
at 1243 (/speedy-app/.next/server/pages/dashboard/edit.js:10516:18)
at __webpack_require__ (/speedy-app/.next/server/webpack-runtime.js:25:42)
at /speedy-app/.next/server/pages/dashboard/edit.js:986:76
at __webpack_require__.a (/speedy-app/.next/server/webpack-runtime.js:89:13)
at 9098 (/speedy-app/.next/server/pages/dashboard/edit.js:978:21)
at __webpack_require__ (/speedy-app/.next/server/webpack-runtime.js:25:42)
at /speedy-app/.next/server/pages/dashboard/edit.js:5176:70
at __webpack_require__.a (/speedy-app/.next/server/webpack-runtime.js:89:13)
at 6211 (/speedy-app/.next/server/pages/dashboard/edit.js:5165:21)
at __webpack_require__ (/speedy-app/.next/server/webpack-runtime.js:25:42)
at /speedy-app/.next/server/pages/dashboard/edit.js:825:67
at __webpack_require__.a (/speedy-app/.next/server/webpack-runtime.js:89:13)
at 2396 (/speedy-app/.next/server/pages/dashboard/edit.js:807:21)
at __webpack_require__ (/speedy-app/.next/server/webpack-runtime.js:25:42)
at /speedy-app/.next/server/pages/dashboard/edit.js:139:66
at __webpack_require__.a (/speedy-app/.next/server/webpack-runtime.js:89:13)
at 2932 (/speedy-app/.next/server/pages/dashboard/edit.js:117:21)
at __webpack_require__ (/speedy-app/.next/server/webpack-runtime.js:25:42)
at /speedy-app/.next/server/pages/dashboard/edit.js:8863:85
at __webpack_require__.a (/speedy-app/.next/server/webpack-runtime.js:89:13)
at 8082 (/speedy-app/.next/server/pages/dashboard/edit.js:8827:21)
at __webpack_require__ (/speedy-app/.next/server/webpack-runtime.js:25:42)
at __webpack_exec__ (/speedy-app/.next/server/pages/dashboard/edit.js:11230:39)
at /speedy-app/.next/server/pages/dashboard/edit.js:11231:165
at __webpack_require__.X (/speedy-app/.next/server/webpack-runtime.js:177:21)
at /speedy-app/.next/server/pages/dashboard/edit.js:11231:47
at Object.<anonymous> (/speedy-app/.next/server/pages/dashboard/edit.js:11234:3)
at Object.requirePage (/speedy-app/node_modules/next/dist/server/require.js:88:12)
at /speedy-app/node_modules/next/dist/server/load-components.js:37:73
at async Object.loadComponents (/speedy-app/node_modules/next/dist/server/load-components.js:37:26)
at async /speedy-app/node_modules/next/dist/build/utils.js:843:32
at async Span.traceAsyncFn (/speedy-app/node_modules/next/dist/trace/trace.js:79:20) {

code: 'ERR_REQUIRE_ESM' }

Build error occurred Error: Failed to collect page data for /dashboard/edit at /speedy-app/node_modules/next/dist/build/utils.js:960:15 { type: 'Error' } npm notice npm notice New major version of npm available! 8.12.1 -> 10.2.5 npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.2.5 npm notice Run npm install -g npm@10.2.5 to update! npm notice`

ealush commented 11 months ago

Hi @Ansub! Thank you for reporting.

Can you try installing emoji-picker-react@4.6.2 and report back?

Ansub commented 11 months ago

I tried installing emoji-picker-react@4.6.2, but I was still experiencing the same error. I had to remove the package from package.json in order to achieve a successful build.

ealush commented 11 months ago

Which bundler do you use? Or.more specifically, which webpack version?

Could it be a cached version of 4.6.1 in node_modules?

Would you mind clearing node modules and reinstalling latest ?