G6 icon indicating copy to clipboard operation
G6 copied to clipboard

[Bug]: nextjs 上: Cannot read properties of undefined (reading 'MapNodeSize')

Open hustcc opened this issue 6 months ago • 4 comments

Describe the bug / 问题描述

Cannot read properties of undefined (reading 'MapNodeSize')
TypeError: Cannot read properties of undefined (reading 'MapNodeSize') at Module.MapNodeSize (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/transforms/index.js:8:121) at Module.MapNodeSize (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/exports.js:76:119) at Object.registerExportsForReactRefresh (webpack-internal:///./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/compiled/@next/react-refresh-utils/dist/internal/helpers.js:52:40) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/exports.js:179:35) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/exports.js:222:7) at ./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/exports.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:33967:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/transforms/get-edge-actual-ends.js:7:66) at ./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/transforms/get-edge-actual-ends.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:34748:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/transforms/index.js:17:79) at ./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/transforms/index.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:34759:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/registry/build-in.js:14:69) at ./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/registry/build-in.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:34473:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/preset.js:2:76) at ./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/preset.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:34462:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/index.js:116:65) at ./node_modules/.pnpm/@[email protected][email protected]/node_modules/@antv/g6/esm/index.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:33978:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@ant-design/graphs/es/index.js:18:66) at ./node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@ant-design/graphs/es/index.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:799:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/@antv/gpt-vis/dist/esm/FishboneDiagram/index.js:4:76) at ./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/@antv/gpt-vis/dist/esm/FishboneDiagram/index.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:35496:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/@antv/gpt-vis/dist/esm/export.js:40:74) at ./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/@antv/gpt-vis/dist/esm/export.js (http://local.alipay.net:3000/_next/static/chunks/new-components_chat_content_ChatCompletion_tsx.js:35925:1) at options.factory (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:736:31) at __webpack_require__ (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:37:33) at fn (http://local.alipay.net:3000/_next/static/chunks/webpack.js?ts=1748077055311:391:21) at eval (webpack-internal:///./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/@antv/gpt-vis/dist/esm/ChartCodeRender/index.js:13:65)

在 nextjs 里面启动最新版本的 5.0.48,直接报错。

大概猜测是 这个 pr 中 layout 版本升级带来的。

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

Version / 版本

Please select / 请选择

OS / 操作系统

  • [x] macOS
  • [ ] Windows
  • [ ] Linux
  • [ ] Others / 其他

Browser / 浏览器

  • [x] Chrome
  • [ ] Edge
  • [ ] Firefox
  • [ ] Safari (Limited support / 有限支持)
  • [ ] IE (Nonsupport / 不支持)
  • [ ] Others / 其他

hustcc avatar May 24 '25 09:05 hustcc

锁定 layout 版本,没有解决~ 锁定 G6 5.0.24 是 ok 的。

hustcc avatar May 24 '25 09:05 hustcc

锁定 layout 版本,没有解决~ 锁定 G6 5.0.24 是 ok 的。

next.js 13.4.7 react 18.3.1 @antv/g6 5.0.24 还是报同样的错误

yzfpf avatar May 26 '25 03:05 yzfpf

我看官网上没问题啊 https://g6.antv.antgroup.com/manual/transform/build-in/map-node-size

yvonneyx avatar May 26 '25 06:05 yvonneyx

跟 nextjs 有关系,估计是因为 ssr 的原因。

hustcc avatar May 27 '25 12:05 hustcc