You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在使用 @antv/g2 库时,遇到了以下错误:
Error: require() of ES Module /path/to/project/node_modules/d3-array/src/index.js from /path/to/project/node_modules/@antv/g2/lib/transform/utils/order.js not supported.
Instead change the require of index.js in /path/to/project/node_modules/@antv/g2/lib/transform/utils/order.js to a dynamic import() which is available in all CommonJS modules.
重现链接
No response
重现步骤
1.使用 vitest 进行单元测试。
2.项目中引入了 @ant-design/plots 和 @ant-design/charts。
3.运行测试时,报错与 @antv/g2 依赖 d3-array 模块不兼容。
预期行为
@antv/g2 应该能够正确处理 ES 模块的导入,避免使用 require() 导入 ES 模块,改为使用 import() 来确保兼容性。
平台
No response
屏幕截图或视频(可选)
No response
补充说明(可选)
可能的解决方案是将 require() 替换为动态 import(),以兼容 ES 模块环境。
The text was updated successfully, but these errors were encountered:
问题描述
在使用 @antv/g2 库时,遇到了以下错误:
Error: require() of ES Module /path/to/project/node_modules/d3-array/src/index.js from /path/to/project/node_modules/@antv/g2/lib/transform/utils/order.js not supported.
Instead change the require of index.js in /path/to/project/node_modules/@antv/g2/lib/transform/utils/order.js to a dynamic import() which is available in all CommonJS modules.
重现链接
No response
重现步骤
1.使用 vitest 进行单元测试。
2.项目中引入了 @ant-design/plots 和 @ant-design/charts。
3.运行测试时,报错与 @antv/g2 依赖 d3-array 模块不兼容。
预期行为
@antv/g2 应该能够正确处理 ES 模块的导入,避免使用 require() 导入 ES 模块,改为使用 import() 来确保兼容性。
平台
No response
屏幕截图或视频(可选)
No response
补充说明(可选)
可能的解决方案是将 require() 替换为动态 import(),以兼容 ES 模块环境。
The text was updated successfully, but these errors were encountered: