{"id":20741,"library":"webpack-deep-scope-plugin","title":"webpack-deep-scope-plugin","description":"A webpack plugin that improves tree-shaking by performing deep scope analysis to eliminate unused imports related to unused exports. Version 1.6.2 requires webpack ^4.14.0 and Node.js 8+. It solves webpack issue #6264 by analyzing variable scopes and removing dead code more aggressively than standard tree-shaking. Uses TypeScript and includes a custom version of escope. Alternative to webpack's built-in sideEffects flag but only works with ES module syntax (import/export).","status":"active","version":"1.6.2","language":"javascript","source_language":"en","source_url":"https://github.com/vincentdchan/webpack-deep-scope-analysis-plugin","tags":["javascript"],"install":[{"cmd":"npm install webpack-deep-scope-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-deep-scope-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-deep-scope-plugin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export; requires .default in CommonJS require.","wrong":"const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin')","symbol":"WebpackDeepScopeAnalysisPlugin","correct":"import WebpackDeepScopeAnalysisPlugin from 'webpack-deep-scope-plugin'"},{"note":"CommonJS require must access .default property.","wrong":"const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin')","symbol":"default","correct":"const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin').default"},{"note":"Destructured require also works.","wrong":null,"symbol":"WebpackDeepScopeAnalysisPlugin","correct":"const { default: WebpackDeepScopeAnalysisPlugin } = require('webpack-deep-scope-plugin')"}],"quickstart":{"code":"// webpack.config.js\nconst WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin').default;\n\nmodule.exports = {\n  // ... other config\n  optimization: {\n    usedExports: true, // required for tree-shaking\n  },\n  plugins: [\n    new WebpackDeepScopeAnalysisPlugin(),\n  ],\n};","lang":"javascript","description":"Shows how to add the plugin to webpack config with CommonJS require and usedExports optimization."},"warnings":[{"fix":"Ensure your code uses ES modules; avoid Babel transforming to CommonJS unless targeting Node.","message":"Plugin only works with import/export syntax, not CommonJS requires or transpiled to module.exports.","severity":"gotcha","affected_versions":"all"},{"fix":"Update references if directly using deep-scope-analyser; plugin API remains same.","message":"Version 1.6.0 renamed the core package to deep-scope-analyser; API unchanged.","severity":"breaking","affected_versions":">=1.6.0"},{"fix":"Use webpack 4.x or find alternative for webpack 5 (e.g., webpack's built-in sideEffects flag).","message":"Requires webpack ^4.14.0; not compatible with webpack 5.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using webpack 5's built-in tree-shaking or sideEffects in package.json.","message":"Plugin may not be actively maintained; last release 1.6.2 in 2019.","severity":"deprecated","affected_versions":">=1.6.2"}],"env_vars":null,"search_vec":"'1.6.2':28 '4.14.0':31 '6264':39 '8':34 'aggress':49 'altern':64 'analysi':18 'analyz':41 'built':69 'built-in':68 'code':47 'custom':60 'dead':46 'deep':3,16 'elimin':20 'es':77 'escop':63 'export':26 'flag':72 'import':22 'import/export':80 'improv':10 'includ':58 'issu':38 'javascript':81 'modul':78 'node.js':33 'perform':15 'plugin':5,8 'relat':23 'remov':45 'requir':29 'scope':4,17,43 'shake':13,54 'sideeffect':71 'solv':36 'standard':51 'syntax':79 'tree':12,53 'tree-shak':11,52 'typescript':56 'unus':21,25 'use':55 'variabl':42 'version':27,61 'webpack':2,7,30,37,66 'webpack-deep-scope-plugin':1 'work':75","created_at":"2026-04-25T11:24:43.851424+00:00","updated_at":"2026-04-25T11:24:43.851424+00:00","problems":[{"fix":"Import via require('webpack-deep-scope-plugin').default","cause":"Forgetting to use .default when requiring with CommonJS.","error":"TypeError: WebpackDeepScopeAnalysisPlugin is not a constructor"},{"fix":"Run npm install deep-scope-analyser","cause":"Missing dependency after npm install (peer dep not auto-installed).","error":"Error: Module not found: Error: Can't resolve 'deep-scope-analyser'"},{"fix":"Ignore the warning if tree-shaking works; or try using webpack 4.43+ which may reduce warnings.","cause":"Plugin uses dynamic require patterns that webpack 4 warns about.","error":"WARNING in ./node_modules/webpack-deep-scope-plugin/dist/index.js Critical dependency: the request of a dependency is an expression"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/vincentdchan/webpack-deep-scope-analysis-plugin","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/webpack-deep-scope-plugin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}