{"id":21247,"library":"esbuild-plugin-ignore","title":"esbuild-plugin-ignore","description":"esbuild-plugin-ignore (v1.1.1) is a plugin for esbuild that allows ignoring specific dependencies during bundling, similar to Webpack's IgnorePlugin. It provides a straightforward way to exclude modules based on regular expressions matching resource and context paths. The package supports both ESM and CommonJS, and is actively maintained. Key differentiators: simple API, no external dependencies, works with esbuild's plugin system. Version 1.1.1 is the latest stable release with no recent changes.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/Knowre-Dev/esbuild-plugin-ignore","tags":["javascript","esbuild","plugin","ignorePlugin"],"install":[{"cmd":"npm install esbuild-plugin-ignore","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-ignore","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-ignore","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package supports both ESM and CommonJS; named import is correct for ESM. For CommonJS, use `const { ignorePlugin } = require('esbuild-plugin-ignore')`.","wrong":"const ignorePlugin = require('esbuild-plugin-ignore')","symbol":"ignorePlugin","correct":"import { ignorePlugin } from 'esbuild-plugin-ignore'"},{"note":"Default import is also valid and returns the same function as named import.","wrong":"import * as ignorePlugin from 'esbuild-plugin-ignore'","symbol":"ignorePlugin (default import)","correct":"import ignorePlugin from 'esbuild-plugin-ignore'"},{"note":"CommonJS users should destructure the require result; there is no .default property.","wrong":"const ignorePlugin = require('esbuild-plugin-ignore').default","symbol":"IgnorePlugin (commonjs)","correct":"const { ignorePlugin } = require('esbuild-plugin-ignore')"}],"quickstart":{"code":"import { ignorePlugin } from 'esbuild-plugin-ignore';\nimport * as esbuild from 'esbuild';\n\nawait esbuild.build({\n  entryPoints: ['src/index.js'],\n  bundle: true,\n  outfile: 'dist/bundle.js',\n  plugins: [\n    ignorePlugin([\n      {\n        resourceRegExp: /pg-native$/,\n        contextRegExp: /node_modules\\/sequelize|node_modules\\/pg/\n      },\n      {\n        resourceRegExp: /tedious|sqlite3|mariadb$/,\n        contextRegExp: /node_modules\\/sequelize/\n      }\n    ])\n  ]\n});","lang":"typescript","description":"Configures esbuild with ignorePlugin to exclude certain modules (e.g., pg-native, tedious) from bundling using Webpack-like ignore rules."},"warnings":[{"fix":"Use specific resourceRegExp and contextRegExp patterns matching only the modules you intend to ignore.","message":"Plugin ignores modules based on RegExp; over-broad patterns may unintentionally exclude necessary dependencies.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure ignored modules are not actually used in your code or provide polyfills as needed.","message":"Plugin does not check if ignored modules are actually required; may produce runtime errors if they are missing.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Explicitly define contextRegExp to avoid unintended matches.","message":"The plugin matches both resource and context; if contextRegExp is not specified, it defaults to '/.*/' matching any context.","severity":"gotcha","affected_versions":"<=1.1.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Either install the missing dependency or add it to the ignorePlugin rule with correct resourceRegExp.","cause":"The module 'pg-native' is being required but esbuild cannot find it because it's not installed or is ignored incorrectly.","error":"Error: Build failed with 1 error: error: Could not resolve 'pg-native'"},{"fix":"Use named import: `import { ignorePlugin } from 'esbuild-plugin-ignore'`","cause":"Importing the plugin incorrectly: using default import when named import is expected, or vice versa.","error":"TypeError: ignorePlugin is not a function"},{"fix":"Run `npm install esbuild-plugin-ignore` or `yarn add esbuild-plugin-ignore`.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'esbuild-plugin-ignore'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}