{"id":25351,"library":"esbuild-plugin-ignore-module","title":"esbuild-plugin-ignore-module","description":"ESBuild plugin to ignore specific module imports during bundling. Current stable version is 0.5.1, maintained and updated occasionally. It allows you to specify module names or patterns to be replaced with empty objects, useful for stripping out server-only or optional dependencies in browser builds. Key differentiator: simple, type-safe (ships TypeScript definitions), and integrates seamlessly with ESBuild's plugin system. Alternatives like `esbuild-plugin-external` fully externalize modules, while this plugin mocks them.","status":"active","version":"0.5.1","language":"javascript","source_language":"en","source_url":"https://github.com/linbudu599/nx-plugins","tags":["javascript","esbuild","ESBuild","ignore","plugin","IgnorePlugin","typescript"],"install":[{"cmd":"npm install esbuild-plugin-ignore-module","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-ignore-module","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-ignore-module","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin requires ESBuild >=0.14.0","package":"esbuild","optional":false}],"imports":[{"note":"ESM-only; no CJS export. Use dynamic import if needed.","wrong":"const ignoreModulePlugin = require('esbuild-plugin-ignore-module')","symbol":"ignoreModulePlugin","correct":"import { ignoreModulePlugin } from 'esbuild-plugin-ignore-module'"},{"note":"This is a type export, only available when using TypeScript or with `import type`.","wrong":"import { IgnoreModuleOption } from 'esbuild-plugin-ignore-module'","symbol":"IgnoreModuleOption","correct":"import type { IgnoreModuleOption } from 'esbuild-plugin-ignore-module'"},{"note":"Default export is the plugin function itself; named export exists too.","wrong":"import { default } from 'esbuild-plugin-ignore-module'","symbol":"default","correct":"import ignoreModulePlugin from 'esbuild-plugin-ignore-module'"}],"quickstart":{"code":"import { build } from 'esbuild';\nimport { ignoreModulePlugin } from 'esbuild-plugin-ignore-module';\n\nawait build({\n  entryPoints: ['src/index.ts'],\n  bundle: true,\n  outfile: 'dist/out.js',\n  plugins: [\n    ignoreModulePlugin({\n      modules: ['fs', 'path', 'crypto']\n    })\n  ]\n});\n","lang":"typescript","description":"This example shows how to ignore Node.js built-in modules (fs, path, crypto) during bundling, replacing them with empty objects."},"warnings":[{"fix":"Ensure your code handles the absence of these modules, e.g., with optional chaining or conditional checks.","message":"The plugin replaces ignored modules with an empty object `{}`. This may cause runtime errors if code expects those modules to exist.","severity":"gotcha","affected_versions":"*"},{"fix":"Update imports to use `ignoreModulePlugin` instead of `ignoreModule`.","message":"Version 0.5.0 changed the plugin's API from `ignoreModule` to `ignoreModulePlugin`. Old code using `import { ignoreModule } from 'esbuild-plugin-ignore-module'` will break.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Convert each string to an object: `{ name: 'moduleName' }`.","message":"Specifying strings directly in the `modules` array is deprecated; use objects with `{ name: 'moduleName' }` instead.","severity":"deprecated","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install esbuild-plugin-ignore-module esbuild` (esbuild as peer dep).","cause":"Package not installed or peer dependency `esbuild` version mismatch.","error":"Error: Cannot find module 'esbuild-plugin-ignore-module'"},{"fix":"Use `ignoreModulePlugin` instead: `import { ignoreModulePlugin } from 'esbuild-plugin-ignore-module'`.","cause":"Using the old API name `ignoreModule` from versions <0.5.0.","error":"TypeError: ignoreModule is not a function"},{"fix":"Use named import: `import { ignoreModulePlugin } from 'esbuild-plugin-ignore-module'` or use dynamic import.","cause":"Trying to default-import in a CommonJS context.","error":"error: No matching export in \"esbuild-plugin-ignore-module\" for import \"default\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}