esbuild-plugin-shelljs
v1.1.2
Published
Patch at build-time the shelljs package to make it compatible with esbuild
Downloads
247
Readme
esbuild-plugin-shelljs
Plugin for esbuild to be able to bundle shelljs. Without this fix, bundling shelljs gives error:
Error: Module not found in bundle: ./src/cat
Install
npm i -D esbuild-plugin-shelljs
import { shellJsPlugin } from "esbuild-plugin-shelljs";
esbuild.build({
// [..]
plugins: [shellJsPlugin],
});
How does it work
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.