Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

服务端渲染示例在最新node下报错 #6592

Closed
Mleijian opened this issue Jan 22, 2025 · 7 comments
Closed

服务端渲染示例在最新node下报错 #6592

Mleijian opened this issue Jan 22, 2025 · 7 comments

Comments

@Mleijian
Copy link

Mleijian commented Jan 22, 2025

我使用文档的示例运行错误,我对前端接触不多,修正一下文档或bug
var d3 = require('d3-color');
^

Error [ERR_REQUIRE_ESM]: require() of ES Module E:\test\node_modules\d3-color\src\index.js from E:\test\node_modules@antv\g-lite\dist\index.js not supported.
Instead change the require of E:\test\node_modules\d3-color\src\index.js in E:\test\node_modules@antv\g-lite\dist\index.js to a dynamic import() which is available in all CommonJS modules.
at Object. (E:\test\node_modules@antv\g-lite\dist\index.js:24:10) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v20.12.0

我修改require未import后,依然不行
const chart = new Chart({
^

ReferenceError: Chart is not defined
at Object. (E:\test\index.js:46:15)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49

@hustcc
Copy link
Member

hustcc commented Jan 22, 2025

锁死 d3 所有库依赖为^2,这个问题已经在解决中了,年前应该能解决。#6594

@hustcc
Copy link
Member

hustcc commented Jan 22, 2025

另外想了解下你用 node ssr 的场景是啥?后面也想开放 ssr 的服务接口出来给社区用,不知道用户量,使用方式如何?

@Mleijian
Copy link
Author

@hustcc 生成简报图片,然后通过邮件或者消息发送

@hustcc
Copy link
Member

hustcc commented Jan 23, 2025

@hustcc 生成简报图片,然后通过邮件或者消息发送

了解了,那我们内部是一样的,如果我们提供对外服务,会愿意使用吗?比如考虑到数据安全不使用之类的。

@Mleijian
Copy link
Author

@hustcc 就是因为考虑到数据安全,我们才生成图片,不止是使用图表,还会有表格

@hustcc
Copy link
Member

hustcc commented Jan 23, 2025

@Mleijian 了解了,那就是图表 ssr,页面类型的就是 Puppeteer 了。

@interstellarmt interstellarmt added the waiting for maintainer Triage or intervention needed from a maintainer label Feb 10, 2025
@hustcc
Copy link
Member

hustcc commented Feb 11, 2025

@hustcc hustcc closed this as completed Feb 11, 2025
@hustcc hustcc removed the waiting for maintainer Triage or intervention needed from a maintainer label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants