Saw the blog post: Bun Runtime - Deploying an app using Bun with Cleavr (Part 3) - Cleavr docs
It explains how to deploy nuxt app with the bun, but it isn’t a bun build. I am trying to build the nuxt app with NITRO_PRESET=bun as explained here Bun - Nitro
But if you include that preset env, application throws error as Bun is not defined:
/opt/pm2/logs/<domain>-error-79.log last 2000 lines:
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
ReferenceError: Bun is not defined
at file:///home/cleavr/<domain>/releases/20241215082913976/.output/server/index.mjs:6414:16
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
Which points out to this line:
Then look into bun’s repo and saw this answer ReferenceError: Bun is not defined · Issue #5263 · oven-sh/bun · GitHub
Which is the --bun
flag with vite, probably thats why the build command on the cleavr’s guide includes that as well. But couldn’t think any workaround for the issue at the moment, do you guys have any suggestions?
In local machine, exact same commands builds and runs application without an issue.