antvis / G2

📊 The concise and progressive visualization grammar.
https://g2.antv.antgroup.com
MIT License
12.13k stars 1.59k forks source link

medianIndex is not exported from d3-array, causing import error in @antv/g2 #6479

Open Hec-gitHub opened 1 month ago

Hec-gitHub commented 1 month ago

问题描述

I encountered an error when trying to compile my project using @antv/g2. The error message is as follows:

Steps to Reproduce

  1. Install @antv/g2 and d3-array@2.12.1
  2. Attempt to compile the project

Expected Behavior

The project should compile without errors.

Actual Behavior

The compilation fails with the error message mentioned above.

Environment

Additional Information

It appears that medianIndex is not exported from d3-array. Here is the output of Object.keys(require('d3-array')): [ 'Adder', 'InternMap', 'InternSet', 'ascending', 'bin', 'bisect', 'bisectCenter', 'bisectLeft', 'bisectRight', 'bisector', 'count', 'cross', 'cumsum', 'descending', 'deviation', 'difference', 'disjoint', 'every', 'extent', 'fcumsum', 'filter', 'fsum', 'greatest', 'greatestIndex', 'group', 'groupSort', 'groups', 'histogram', 'index', 'indexes', 'intersection', 'least', 'leastIndex', 'map', 'max', 'maxIndex', 'mean', 'median', 'merge', 'min', 'minIndex', 'nice', 'pairs', 'permute', 'quantile', 'quantileSorted', 'quickselect', 'range', 'reduce', 'reverse', 'rollup', 'rollups', 'scan', 'shuffle', 'shuffler', 'some', 'sort', 'subset', 'sum', 'superset', 'thresholdFreedmanDiaconis', 'thresholdScott', 'thresholdSturges', 'tickIncrement', 'tickStep', 'ticks', 'transpose', 'union', 'variance', 'zip' ] Please provide guidance on how to resolve this issue.

重现链接

No response

重现步骤

No response

预期行为

No response

平台

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

hustcc commented 1 month ago

use d3-array@^3

Hec-gitHub commented 1 month ago

use d3-array@^3

Thank you very much for re.I'll try.

Hec-gitHub commented 1 month ago

use d3-array@^3

I tried to install version 3.2.4 and the above error was resolved, but another error occurred while compiling the project. The specific compilation error is as follows:

`- info Creating an optimized production build

Error [ERR_REQUIRE_ESM]: require() of ES Module /data/git/DB-GPT/web/node_modules/d3-array/src/index.js from /data/git/DB-GPT/web/node_modules/d3-geo/dist/d3-geo.js not supported. Instead change the require of index.js in /data/git/DB-GPT/web/node_modules/d3-geo/dist/d3-geo.js to a dynamic import() which is available in all CommonJS modules. at /data/git/DB-GPT/web/node_modules/d3-geo/dist/d3-geo.js:3:81 at Object. (/data/git/DB-GPT/web/node_modules/d3-geo/dist/d3-geo.js:6:2) at Object.70312 (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:247:18) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.78278 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:5703:18) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.40509 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:6043:17) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.90288 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:17282:23) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.78841 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:23698:22) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.3876 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:22809:19) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.49160 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:21870:22) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.87978 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:23955:21) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.81308 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:25234:16) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.5000 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:22953:16) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.35244 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:16369:19) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.76814 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:12501:17) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.82636 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:13847:26) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.36349 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:17323:23) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.10288 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:17549:14) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.86300 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:10728:15) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.75174 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:39893:14) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.43127 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:39951:15) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.83325 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:25:11) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at Object.12179 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:1008:17) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at /data/git/DB-GPT/web/.next/server/chunks/2119.js:1718:75 at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13) at Object.32119 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:1713:21) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at /data/git/DB-GPT/web/.next/server/chunks/2119.js:2661:94 at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13) at Object.12186 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:2656:21) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at /data/git/DB-GPT/web/.next/server/chunks/8233.js:16:96 at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13) at Object.68233 (/data/git/DB-GPT/web/.next/server/chunks/8233.js:9:21) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:30:133 at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13) at Object.88617 (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:11:21) at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42) at webpack_exec (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3799:39) at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3800:158 at Function.webpack_require.X (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:177:21) at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3800:47 at Object. (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3803:3) at requirePage (/data/git/DB-GPT/web/node_modules/next/dist/server/require.js:156:12) at /data/git/DB-GPT/web/node_modules/next/dist/server/load-components.js:68:84 at async loadComponentsImpl (/data/git/DB-GPT/web/node_modules/next/dist/server/load-components.js:68:26) at async /data/git/DB-GPT/web/node_modules/next/dist/build/utils.js:1008:32 at async Span.traceAsyncFn (/data/git/DB-GPT/web/node_modules/next/dist/trace/trace.js:103:20) { code: 'ERR_REQUIRE_ESM' }

Build error occurred Error: Failed to collect page data for /construct/app/extra/components/auto-plan/DetailsCard at /data/git/DB-GPT/web/node_modules/next/dist/build/utils.js:1161:15 at processTicksAndRejections (node:internal/process/task_queues:96:5) { type: 'Error' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

hustcc commented 1 month ago

error of d3 in nextjs. https://github.com/d3/d3-array/issues/218