{"id":20781,"library":"webpack-inject-entry-plugin","title":"Webpack Inject Entry Plugin","description":"A webpack plugin to inject a filepath into a webpack entry point, enabling plugin authors to inject code into the bundle before compilation. Current stable version is 0.0.4, with low release cadence (last release Aug 2023). Works with both Webpack 4 and 5. Lightweight alternative to custom entry manipulation, with TypeScript type declarations included.","status":"active","version":"0.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/tatethurston/webpack-inject-entry-plugin","tags":["javascript","entry","inject","plugin","webpack","typescript"],"install":[{"cmd":"npm install webpack-inject-entry-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-inject-entry-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-inject-entry-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to run plugin","package":"webpack","optional":false}],"imports":[{"note":"Package uses default export; in CommonJS you must use require('webpack-inject-entry-plugin').default","wrong":"const InjectEntryPlugin = require('webpack-inject-entry-plugin')","symbol":"default","correct":"import InjectEntryPlugin from 'webpack-inject-entry-plugin'"},{"note":"CommonJS users need to access .default property because package is ESM-like","wrong":"const InjectEntryPlugin = require('webpack-inject-entry-plugin')","symbol":".default","correct":"const InjectEntryPlugin = require('webpack-inject-entry-plugin').default"},{"note":"Named import does not exist; must use default import","wrong":"import { InjectEntryPlugin } from 'webpack-inject-entry-plugin'","symbol":"InjectEntryPlugin","correct":"import InjectEntryPlugin from 'webpack-inject-entry-plugin'"}],"quickstart":{"code":"// webpack.config.js\nconst InjectEntryPlugin = require('webpack-inject-entry-plugin').default;\n\nmodule.exports = {\n  entry: {\n    main: './src/index.js',\n  },\n  plugins: [\n    new InjectEntryPlugin({\n      entry: 'main',\n      filepath: './inject.js'\n    }),\n  ],\n};\n\n// inject.js\nconsole.log('Injected code running!');","lang":"javascript","description":"Shows how to use the plugin to inject a file into the 'main' entry."},"warnings":[{"fix":"Use require('webpack-inject-entry-plugin').default","message":"Plugin expects a default export; CommonJS users must require .default property.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure webpack version is 4 or 5","message":"Only compatible with Webpack 4 and 5; not tested with Webpack 3 or lower.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Verify entry name matches exactly","message":"entry option must match an existing entry name in webpack config.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use const InjectEntryPlugin = require('webpack-inject-entry-plugin').default;","cause":"Forgetting to call .default when using require()","error":"TypeError: InjectEntryPlugin is not a constructor"},{"fix":"Check that entry name matches exactly, e.g., 'main' for default entry","cause":"Provided entry name does not exist in webpack configuration","error":"Error: Entry 'main' not found. Make sure entry exists."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}