d3 / d3-geo

Geographic projections, spherical shapes and spherical trigonometry.

Home Page:https://d3js.org/d3-geo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module / require() of ES modules is not supported

Fullstack-WEB-Blockchain-Developer opened this issue · comments

I have suddenly started getting with Nextjs project(typescript) the following error:

$ npm run dev

error - Error [ERR_REQUIRE_ESM]: require() of ES Module ...\project\node_modules\d3-geo\src\index.js from ...\project\node_modules\three-geojson-geometry\dist\three-geojson-geometry.common.js not supported.
Instead change the require of index.js in ...\project\node_modules\three-geojson-geometry\dist\three-geojson-geometry.common.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (...\project\node_modules\three-geojson-geometry\dist\three-geojson-geometry.common.js:7:13)
    at Object.<anonymous> (...\project\node_modules\three-globe\dist\three-globe.common.js:6:28)
    at Object.three-globe (...\project\.next\server\pages\tsglobe.js:1186:18)
    at __webpack_require__ (...\project\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/utils/globe/systems/Globe.ts:5:69)
    at Object../src/utils/globe/systems/Globe.ts (...\project\.next\server\pages\tsglobe.js:660:1)
    at __webpack_require__ (...\project\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/utils/globe/components/globe.ts:8:72)
    at Function.__webpack_require__.a (...\project\.next\server\webpack-runtime.js:97:13)
    at eval (webpack-internal:///./src/utils/globe/components/globe.ts:1:21)
    at Object../src/utils/globe/components/globe.ts (...\project\.next\server\pages\tsglobe.js:627:1)
    at __webpack_require__ (...\project\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/utils/globe/index.ts:8:75)
    at Function.__webpack_require__.a (...\project\.next\server\webpack-runtime.js:97:13)
    at eval (webpack-internal:///./src/utils/globe/index.ts:1:21)
    at Object../src/utils/globe/index.ts (...\project\.next\server\pages\tsglobe.js:649:1)
    at __webpack_require__ (...\project\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/pages/tsglobe.tsx:14:69)
    at Function.__webpack_require__.a (...\project\.next\server\webpack-runtime.js:97:13)
    at eval (webpack-internal:///./src/pages/tsglobe.tsx:1:21)
    at Object../src/pages/tsglobe.tsx (...\project\.next\server\pages\tsglobe.js:583:1)
    at __webpack_require__ (...\project\.next\server\webpack-runtime.js:33:42)
    at __webpack_exec__ (...\project\.next\server\pages\tsglobe.js:1251:39)
    at ...\project\.next\server\pages\tsglobe.js:1252:28
    at Object.<anonymous> (...\project\.next\server\pages\tsglobe.js:1255:3)
    at Object.requirePage (...\project\node_modules\next\dist\server\require.js:58:12)
    at ...\project\node_modules\next\dist\server\load-components.js:56:50
    at runMicrotasks (<anonymous>)
    at async Promise.all (index 2)
    at async Object.loadComponents (...\project\node_modules\next\dist\server\load-components.js:53:49)
    at async DevServer.findPageComponents (...\project\node_modules\next\dist\server\next-server.js:451:36) {
  code: 'ERR_REQUIRE_ESM',
  page: '/tsglobe'
}

This doesn't make any sense, as I am not using require() anywhere at all.

Is this the reason for the module itself?
This issue same as #261 but I can't solution.

Please do not open issues when you know they are duplicates, this is wasting everybody's time.

Please do not open issues when you know they are duplicates, this is wasting everybody's time.

But this issue #261 was not solved but It was closed.
I think we need to open any ticket.