machiM
Convex Community7mo ago
3 replies
machi

I have a problem with esbuild. I'm

I have a problem with esbuild. I'm trying to use the unified with remark-parse on server side. It uses nested dependency decode-named-character-reference which has multiple exports dependent on platform. ESBuild set platform to "browser", which causes push to fail because it tries to bundle index.dom.js instead of index.js.

Failed to analyze xxx.js: Uncaught ReferenceError: document is not defined
    at <anonymous> (../node_modules/decode-named-character-reference/index.dom.js:10:16)


  "exports": {
    "deno": "./index.js",
    "edge-light": "./index.js",
    "react-native": "./index.js",
    "worker": "./index.js",
    "workerd": "./index.js",
    "browser": "./index.dom.js",
    "default": "./index.js"
  },


Is there any way to mitigate that?
Was this page helpful?