Skip to content

7PH/esbuild-plugin-shelljs

Repository files navigation

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.

About

Plugin for esbuild to be able to bundle shelljs

Resources

Stars

Watchers

Forks