Registry / devops / webpack-inject-entry-plugin

webpack-inject-entry-plugin

JSON →
library0.0.4jsnpmunverified

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.

npm install webpack-inject-entry-plugin
INSTALL
IMPORT
SIG · WEBPACK-INJECT-ENT
W
webpack-inject-entry-plugin
devopsjavascriptv0.0.4
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import InjectEntryPlugin from 'webpack-inject-entry-plugin'
✗ const InjectEntryPlugin = require('webpack-inject-entry-plugin')
Package uses default export; in CommonJS you must use require('webpack-inject-entry-plugin').default
.default
✓ const InjectEntryPlugin = require('webpack-inject-entry-plugin').default
✗ const InjectEntryPlugin = require('webpack-inject-entry-plugin')
CommonJS users need to access .default property because package is ESM-like
InjectEntryPlugin
✓ import InjectEntryPlugin from 'webpack-inject-entry-plugin'
✗ import { InjectEntryPlugin } from 'webpack-inject-entry-plugin'
Named import does not exist; must use default import

Shows how to use the plugin to inject a file into the 'main' entry.

// webpack.config.js const InjectEntryPlugin = require('webpack-inject-entry-plugin').default; module.exports = { entry: { main: './src/index.js', }, plugins: [ new InjectEntryPlugin({ entry: 'main', filepath: './inject.js' }), ], }; // inject.js console.log('Injected code running!');
Debug
Known issues
gotchaPlugin expects a default export; CommonJS users must require .default property.
fix
Use require('webpack-inject-entry-plugin').default
affects: >=0.0.0
gotchaOnly compatible with Webpack 4 and 5; not tested with Webpack 3 or lower.
fix
Ensure webpack version is 4 or 5
affects: >=0.0.0
gotchaentry option must match an existing entry name in webpack config.
fix
Verify entry name matches exactly
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: InjectEntryPlugin is not a constructor
Forgetting to call .default when using require()
fix
Use const InjectEntryPlugin = require('webpack-inject-entry-plugin').default;
Error: Entry 'main' not found. Make sure entry exists.
Provided entry name does not exist in webpack configuration
fix
Check that entry name matches exactly, e.g., 'main' for default entry
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
webpackrequiredpeer dependency required to run plugin
Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources
webpack-inject-entry-plugin — npm install webpack-inject-entry-plugin · libregistry