Guide
Bundler usage
Typically srvx
is to be imported like this.
import { serve } from "srvx";
The import above, automatically resolves the the correct entrypoint for each runtime. Node.js, Deno and Bun use ESM conditions to resolve the correct entrypoint.
If you are directly using srvx
in your project without bundling or having srvx
as a non-bundled dependency
in package.json
it should work as expected.
Bundler usage
If srvx is being bundled (by for example rollup), just during bundling the bundler also has to run the ESM resolution algorithm with a specific ESM condition. This will result srvx
in the bundle to be only working with one specific runtime.
In order to avoid this, simplest way is to put srvx
into the externals
options.