馃悰 Bug Report
Problem Description
I encountered an issue when using esbuild to bundle a project that imports the zx library. The bundled output file fails to run due to the absence of the core.cjs file, which is required by the zx library.
Steps to Reproduce
- Create a TypeScript file that imports the
zx library.
- Use
esbuild to bundle the file.
- Attempt to run the bundled JavaScript output.
Expected Behavior
The bundled JavaScript file should run without errors, and the functionality from the zx library should work as expected.
Actual Behavior
After bundling with esbuild, the generated JavaScript file does not include the necessary core.cjs file, leading to runtime errors.
Reproduction Files
- Original TypeScript file:
import { $ } from 'zx/core';
const main = async () => {
const list = ['5', '10', '15', '20', '25'];
for (const item of list) {
console.log(`${item} start`);
await $`sleep ${item}`;
console.log(`${item} end`);
}
}
main();
"use strict";
// node_modules/.pnpm/zx@8.1.6/node_modules/zx/build/deno.js
var import_node_module = require("node:module");
var import_meta = {};
var require2 = (0, import_node_module.createRequire)(import_meta.url);
var __filename = new URL(import_meta.url).pathname;
var __dirname = new URL(".", import_meta.url).pathname;
if (globalThis.Deno) {
globalThis.require = require2;
globalThis.__filename = __filename;
globalThis.__dirname = __dirname;
}
// node_modules/.pnpm/zx@8.1.6/node_modules/zx/build/core.js
var {
$,
ProcessOutput,
ProcessPromise,
cd,
defaults,
kill,
log,
syncProcessCwd,
useBash,
usePowerShell,
usePwsh,
within
} = require2("./core.cjs");
// test.ts
var main = async () => {
const list = ["5", "10", "15", "20", "25"];
for (const item of list) {
console.log(`${item} start`);
await $`sleep ${item}`;
console.log(`${item} end`);
}
};
main();
Build Command
The command used for bundling:
esbuild ./test.ts --bundle --outfile=out.js --platform=node --target=node18
Specifications
- zx version: 8.1.6
- Platform: macos
- Runtime: node
馃悰 Bug Report
Problem Description
I encountered an issue when using esbuild to bundle a project that imports the zx library. The bundled output file fails to run due to the absence of the core.cjs file, which is required by the
zxlibrary.Steps to Reproduce
zxlibrary.esbuildto bundle the file.Expected Behavior
The bundled JavaScript file should run without errors, and the functionality from the
zxlibrary should work as expected.Actual Behavior
After bundling with
esbuild, the generated JavaScript file does not include the necessarycore.cjsfile, leading to runtime errors.Reproduction Files
Build Command
The command used for bundling:
esbuild ./test.ts --bundle --outfile=out.js --platform=node --target=node18
Specifications