typescriptremix.runbun

Production build `undefined is not a function (near '...jsxDEV...')`


I'm using bun and express to run my production server, and the dev server runs just fine. When ever I build, and make a require to remix, the following error is produced:

$ NODE_ENV=production bun run src/index.ts
[12:00:19.443] INFO (83887): API listening on port 8080
62 |   let controller = new AbortController(), rendered = !1;
63 |   setTimeout(() => {
64 |     rendered || controller.abort();
65 |   }, ABORT_DELAY);
66 |   let stream = await renderToReadableStream(
67 |     /* @__PURE__ */ jsxDEV(
                         ^
TypeError: undefined is not a function (near '...jsxDEV...')
      at /Users/dangoodman/code/sellmyai/build/index.js:67:21
      at handleBrowserRequest (/Users/dangoodman/code/sellmyai/build/index.js:61:37)
      at /Users/dangoodman/code/sellmyai/node_modules/@remix-run/server-runtime/dist/server.js:224:18
      at processTicksAndRejections (:61:77)

62 |   let controller = new AbortController(), rendered = !1;
63 |   setTimeout(() => {
64 |     rendered || controller.abort();
65 |   }, ABORT_DELAY);
66 |   let stream = await renderToReadableStream(
67 |     /* @__PURE__ */ jsxDEV(
                         ^
TypeError: undefined is not a function (near '...jsxDEV...')
      at /Users/dangoodman/code/sellmyai/build/index.js:67:21
      at handleBrowserRequest (/Users/dangoodman/code/sellmyai/build/index.js:61:37)
      at /Users/dangoodman/code/sellmyai/node_modules/@remix-run/server-runtime/dist/server.js:251:20
      at processTicksAndRejections (:61:77)

[12:00:22.963] DEBUG (83887): loaded URL
    URL: "http://localhost:8080/"

My entry.server.tsx is completely stock: https://github.com/remix-run/remix/blob/main/templates/express/app/entry.server.tsx

This only seems to happen locally when running on my laptop (macOS x64), within a docker build it seems to work fine


Solution

  • Needed to set NODE_ENV=production:

    "build": "NODE_ENV=production remix build"