I am using this in a React component in Astro, and it renders the diagram and everything works fine locally. But when building for production, vitejs throws the following error:
#17 64.89 18:39:42 [ERROR] [vite] x Build failed in 8.36s
#17 65.05 node_modules/@beoe/rehype-code-hook/dist/index.js (6:9): "serialize" is not exported by "__vite-browser-external", imported by "node_modules/@beoe/rehype-code-hook/dist/index.js".
#17 65.05 file: /build/node_modules/@beoe/rehype-code-hook/dist/index.js:6:9
#17 65.05
#17 65.05 4: // Other options: askorama/seqproto, pouya-eghbali/sia, deterministic-object-hash
#17 65.05 5: // I haven't benchmarked it
#17 65.05 6: import { serialize } from "node:v8";
#17 65.05 ^
#17 65.05 7: export { waitFor } from "./waitFor.js";
#17 65.05 8: function isNode(node) {
#17 65.05
#17 65.05 Stack trace:
#17 65.05 at getRollupError (file:///build/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
#17 65.05 at Module.error (file:///build/node_modules/rollup/dist/es/shared/node-entry.js:14844:16)
#17 65.05 at ModuleScope.findVariable (file:///build/node_modules/rollup/dist/es/shared/node-entry.js:13192:39)
#17 65.05 at FunctionBodyScope.findVariable (file:///build/node_modules/rollup/dist/es/shared/node-entry.js:5221:38)
#17 65.05 at FunctionBodyScope.findVariable (file:///build/node_modules/rollup/dist/es/shared/node-entry.js:5221:38)
I am using this in a React component in Astro, and it renders the diagram and everything works fine locally. But when building for production, vitejs throws the following error: