Registry / http-networking / deep-scope-analyser

deep-scope-analyser

JSON →
library1.7.0jsnpmunverified

Webpack plugin (npm package deep-scope-analyser v1.7.0, low activity) that improves tree-shaking by performing deep scope analysis to eliminate unused imports and exports. Designed for webpack 4.14.0+ and Node.js 8+. It solves webpack issue #6264 by analyzing variable scopes to determine which imports can be safely removed, beyond what webpack's built-in tree-shaking achieves. The plugin works only with ES module syntax (import/export) and requires the PURE annotation for side-effect marking. Originally named webpack-deep-scope-plugin (v1.5.x), renamed to deep-scope-analyser in v1.6.0 for standalone use. Maintained by a GSoC 2018 student, but has seen no updates since 2019. Differentiators: deeper analysis than standard tree-shaking; but limited to webpack 4 and ESM-only, with potential compatibility issues.

npm install deep-scope-analyser
INSTALL
IMPORT
SIG · DEEP-SCOPE-ANALYSE
D
deep-scope-analyser
http-networkingjavascriptv1.7.0
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.

default
import WebpackDeepScopeAnalysisPlugin from 'webpack-deep-scope-plugin';
import { WebpackDeepScopeAnalysisPlugin } from 'webpack-deep-scope-plugin';
Default export; the package ships TypeScript definitions.
default
const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin').default;
const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin');
CommonJS require must explicitly access .default because the package uses ESM-style default export.
default
import WebpackDeepScopeAnalysisPlugin from 'deep-scope-analyser';
import { default as WebpackDeepScopeAnalysisPlugin } from 'deep-scope-analyser';
Alternative package name deep-scope-analyser also works; same default import pattern.

Adds deep scope analysis plugin to a webpack 4 production config to improve tree-shaking.

// webpack.config.js const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin').default; module.exports = { mode: 'production', entry: './src/index.js', output: { path: __dirname + '/dist', filename: 'bundle.js' }, plugins: [ new WebpackDeepScopeAnalysisPlugin() ] };
Debug
Known issues
breakingRenamed from webpack-deep-scope-plugin (v1.5.x) to deep-scope-analyser (v1.6.0). Existing import paths break.
fix
Use package deep-scope-analyser or continue using webpack-deep-scope-plugin (v1.5.4) for older webpack.
affects: >=1.6.0
deprecatedPackage has not been updated since 2019; may be incompatible with webpack 5 and modern Node.js (>=14).
fix
Consider alternatives like webpack's built-in sideEffects flag or optimization.usedExports for webpack 5+.
affects: >=1.7.0
gotchaThe plugin only works with ES module syntax (import/export). If Babel or TypeScript transpile to CommonJS (require/module.exports), the analysis fails silently.
fix
Ensure your code uses native ES modules; avoid using @babel/plugin-transform-modules-commonjs.
affects: all
gotchaCommonJS require('webpack-deep-scope-plugin') returns an empty object; must use .default property.
fix
Use const Plugin = require('webpack-deep-scope-plugin').default;
affects: >=1.6.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'webpack-deep-scope-plugin'
Package was renamed to deep-scope-analyser in v1.6.0.
fix
npm install deep-scope-analyser (or pin version to 1.5.4) and update import to deep-scope-analyser.
TypeError: webpackDeepScopeAnalysisPlugin is not a constructor
Using CommonJS require without .default property.
fix
const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin').default;
Error: Cannot find module 'webpack'
Missing webpack peer dependency.
fix
npm install webpack@4 --save-dev
Upgrade
Version history
1.7.0latest on npm
Audit
Dependencies
webpackrequiredCore dependency: the plugin integrates as a webpack plugin, requiring webpack >=4.14.0.
Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
deep-scope-analyser — npm install deep-scope-analyser · libregistry