nitro-wrangler is a Nitro module that rewrites Nitro's Cloudflare server output into a builderless-style worker bundle.
Archived status
This repository is a temporary workaround and is now superseded by the upstream Nitro alternative in
nitrojs/nitro#4136, "fix(build): handle rolldown external requires in nodeless builds".This repository is archived and will not receive further development.
It changes the final .output/server shape so that:
- user code is emitted as relative imports instead of being bundled into Nitro output
- Nitro runtime chunks stay in
.output/server/_libs - generated
wrangler.jsonis rewritten with"main": "index.mjs"and"no_bundle": false
npm i nitro-wranglerAlso install Nitro in your app:
npm i nitroimport { defineConfig } from "nitro/config";
import nitroWrangler from "nitro-wrangler";
export default defineConfig({
preset: "cloudflare-module",
modules: [nitroWrangler],
});After nitro build, the worker entry in .output/server/index.mjs will import your app code via relative paths, and Wrangler can bundle the user graph from there.
Build the package:
bun run buildRun the example app from the playground package:
bun run --cwd playground build
bunx wrangler deploy -c playground/.output/server/wrangler.json --dry-run