G6
G6 copied to clipboard
Vitepress build Error [ERR_REQUIRE_ESM]: require() of ES Module
Describe the bug
I use the G6.TreeGraph module, which works on dev, and I get errors when I build
Error [ERR_REQUIRE_ESM]: require() of ES Module E:\project\shopping\node_modules\.pnpm\[email protected]\node_modules\d3-interpolate\src\index.js from E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g-base\lib\animate\timeline.js not supported.
Instead change the require of index.js in E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g-base\lib\animate\timeline.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g-base\lib\animate\timeline.js:5:24)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g-base\lib\abstract\canvas.js:7:18)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g-base\lib\index.js:17:16)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g6-core\lib\interface\behavior.js:8:14)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g6-core\lib\util\base.js:8:17)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g6-core\lib\graph\controller\view.js:9:13)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g6-core\lib\graph\controller\index.js:31:36)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g6-core\lib\graph\graph.js:15:19)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g6-core\lib\index.js:94:37)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@antv\g6-pc\lib\index.js:101:15)
at Object.<anonymous> (E:\project\shopping\node_modules\.pnpm\@[email protected]\node_modules\@antv\g6\lib\index.js:11:37)
at async build (file:///E:/project/shopping/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_axio_vnfibxwjskcyfxbpm5lhadvxse/node_modules/vitepress/dist/node/serve-BwR5EPUJ.js:46734:24) {
code: 'ERR_REQUIRE_ESM'
}
Your Example Website or App
https://github.com/QC2168/vitepress-g6-build-error
Steps to Reproduce the Bug or Issue
- pnpm install
- pnpm build
Expected behavior
It should work properly
Screenshots or Videos
No response
Platform
- OS: Windows
- Browser: Chrome
Additional context
No response