Registry / devops / remove-source-webpack-plugin

remove-source-webpack-plugin

JSON →
library0.1.1jsnpmunverified

A lightweight webpack plugin that removes specified assets from the compilation output, commonly used in conjunction with html-webpack-inline-source-plugin to eliminate inlined source files from the final bundle. The current version is 0.1.1. It accepts regex or an array of regex patterns to match assets for removal. The plugin is available as an npm package under an MIT license.

npm install remove-source-webpack-plugin
INSTALL
IMPORT
SIG · REMOVE-SOURCE-WEBP
R
remove-source-webpack-plugin
devopsjavascriptv0.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

RemoveSourceWebpackPlugin
const RemoveSourceWebpackPlugin = require('remove-source-webpack-plugin')
import RemoveSourceWebpackPlugin from 'remove-source-webpack-plugin'
ESM import works, but the package is CommonJS by default; require is safe for all environments
default export
const RemoveSourceWebpackPlugin = require('remove-source-webpack-plugin')
const plugin = require('remove-source-webpack-plugin').default
Default export is the class itself, no .default needed
alias import
import RemoveSourceWebpackPlugin from 'remove-source-webpack-plugin'
import { RemoveSourceWebpackPlugin } from 'remove-source-webpack-plugin'
Named import fails because it's a default export

Shows how to require and instantiate the plugin with a regex pattern to remove runtime chunk files.

const RemoveSourceWebpackPlugin = require('remove-source-webpack-plugin'); module.exports = { // ... other webpack config plugins: [ new RemoveSourceWebpackPlugin(/runtime\..*\.js$/), ], };
Debug
Known issues
gotchaPlugin only works in webpack 4 and 5, not webpack 3.
fix
Ensure webpack version is 4 or 5.
affects: >=0.1.0
gotchaUsing an empty array or no patterns removes nothing; patterns must match asset names exactly.
fix
Provide regex patterns that match asset filenames, not paths.
affects: >=0.1.0
gotchaThe plugin removes assets from compilation, not from the file system.
fix
It works after emit hooks, so removed assets won't appear in output directory.
affects: >=0.1.0
gotchaMultiple plugins of same type can be added; each removes matching assets.
fix
You can add multiple instances with different patterns.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: Super expression must either be null or a function
Webpack version mismatch (e.g., webpack 3)
fix
Upgrade to webpack 4 or 5.
ERROR: RemoveSourceWebpackPlugin is not a constructor
Attempted to import using named import 'RemoveSourceWebpackPlugin'
fix
Use default import: const RemoveSourceWebpackPlugin = require('remove-source-webpack-plugin');
Module not found: Error: Can't resolve 'remove-source-webpack-plugin'
Package not installed or webpack config path issue
fix
Run `npm install remove-source-webpack-plugin --save-dev`.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
remove-source-webpack-plugin — npm install remove-source-webpack-plugin · libregistry