Plugin for esbuild to be able to bundle shelljs. Without this fix, bundling shelljs gives error:
Error: Module not found in bundle: ./src/cat
npm i -D esbuild-plugin-shelljsimport { shellJsPlugin } from "esbuild-plugin-shelljs";
esbuild.build({
// [..]
plugins: [shellJsPlugin],
});This plugin patches the shelljs dependency before bundling it. Esbuild knows the path of shelljs local dependencies with .js suffixes, but a dynamic import which omits the extension makes esbuild fail to resolve dependencies. The patch adds .js to the dynamic imports.