Lines 199-239javascript
199 fileExists: () => false,
200 readFile: () => undefined,
203 const execaStubPath = "execa-stub.mjs";
204 await writeFile(join(outputDirectory, this.outputDir, execaStubPath), `// Stub for execa - not available at runtime in Cloudflare Workers
205export const execa = () => { throw new Error('execa is not available in Cloudflare Workers'); };
206export const execaNode = execa;
207export const execaSync = execa;
208export const execaCommand = execa;
209export const execaCommandSync = execa;
210export const $ = execa;
212 const readableStreamStubPath = "readable-stream-stub.mjs";
213 await writeFile(join(outputDirectory, this.outputDir, readableStreamStubPath), `// Redirect readable-stream to native node:stream (available via nodejs_compat)
214import stream from 'node:stream';
215export const { Readable, Writable, Duplex, Transform, PassThrough, Stream, pipeline, finished } = stream;
216export default stream;
218 const moduleStubPath = "module-stub.mjs";
219 await writeFile(join(outputDirectory, this.outputDir, moduleStubPath), `// Stub for module.createRequire in Cloudflare Workers
220export function createRequire() {
221 const req = specifier => {
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/index.jsView on unpkg · L219 222 throw new Error(\`require(\${specifier}) is not available in Cloudflare Workers\`);
224 req.resolve = specifier => specifier;
227export default { createRequire };
229 const wranglerConfig = {
231 compatibility_date: "2025-04-01",
232 compatibility_flags: ["nodejs_compat", "nodejs_compat_populate_process_env"],
233 observability: { logs: { enabled: true } },
238 typescript: `./${typescriptStubPath}`,
239 execa: `./${execaStubPath}`,