machiM
Convex Community7mo ago
12 replies
machi

Esbuild bundle uses "browser" platform which causes depenency issues.

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"
  },


https://github.com/get-convex/convex-js/blob/main/scripts/bundle-server.mjs
GitHub
TypeScript/JavaScript client library for Convex. Contribute to get-convex/convex-js development by creating an account on GitHub.
convex-js/scripts/bundle-server.mjs at main · get-convex/convex-js
Was this page helpful?