{"id":13452521,"url":"https://github.com/vincentdchan/webpack-deep-scope-analysis-plugin","last_synced_at":"2025-04-08T12:07:53.556Z","repository":{"id":32067354,"uuid":"124771956","full_name":"vincentdchan/webpack-deep-scope-analysis-plugin","owner":"vincentdchan","description":"A webpack plugin for deep scope analysis","archived":false,"fork":false,"pushed_at":"2022-12-03T03:12:01.000Z","size":1113,"stargazers_count":616,"open_issues_count":23,"forks_count":28,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-05-21T12:50:28.560Z","etag":null,"topics":["webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vincentdchan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-11T15:45:16.000Z","updated_at":"2024-02-27T21:00:59.000Z","dependencies_parsed_at":"2023-01-14T20:30:39.980Z","dependency_job_id":null,"html_url":"https://github.com/vincentdchan/webpack-deep-scope-analysis-plugin","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincentdchan%2Fwebpack-deep-scope-analysis-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincentdchan%2Fwebpack-deep-scope-analysis-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincentdchan%2Fwebpack-deep-scope-analysis-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincentdchan%2Fwebpack-deep-scope-analysis-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vincentdchan","download_url":"https://codeload.github.com/vincentdchan/webpack-deep-scope-analysis-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838444,"owners_count":21004580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["webpack","webpack-plugin"],"created_at":"2024-07-31T07:01:26.488Z","updated_at":"2025-04-08T12:07:53.533Z","avatar_url":"https://github.com/vincentdchan.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Webpack Deep Scope Analysis Plugin\n\nThis project is not maintained.\n\n**TLDR: This plugin will break your code, please use webpack5 instead.**\n\nThis plugin can not work perfectly with webpack4. It will break your code in some cases. Webpack5 covers all the features implemented by this plugin, using wepback5 is a wise choice.\n\nThe reason according to [sokra](https://github.com/sokra):\n\n\u003e With DependencyReference returning null you prevent the module to be part of the chunk, but the Dependency doesn't know about that and always generates code to reference the module and try to load it at runtime. But there is no way to tell the Dependency that.\n\n\n![](https://travis-ci.org/vincentdchan/webpack-deep-scope-analysis-plugin.svg?branch=master)\n[![npm version](https://badge.fury.io/js/webpack-deep-scope-plugin.svg)](https://badge.fury.io/js/webpack-deep-scope-plugin)\n\nA webpack plugin for deep scope analysis.\nIt's a project of [GSoC 2018](https://summerofcode.withgoogle.com/organizations/4657420148670464/#projects) webpack organization.\n\n**It's a plugin to improve tree-shaking.** It can make webpack eliminate the unused imports related to the unused exports. It solves the issue [6254](https://github.com/webpack/webpack/issues/6264) for webpack.\n\nStudent: [@Vincent](https://github.com/vincentdchan)   Mentor: [@Tobias](https://github.com/sokra)\n\nDemo: [https://vincentdchan.github.io/webpack-deep-scope-demo/](https://vincentdchan.github.io/webpack-deep-scope-demo/)\n\n# Install\n\nInstall the plugin:\n\n```bash\n$ yarn add webpack-deep-scope-plugin\n```\n\n## Require\n\n- Node.js 8 \\+\n- webpack 4.14.0 \\+\n\n# Usage\n\nEnable the plugin in `webpack.config.js`:\n\n```javascript\nconst WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin').default;\n\nmodule.exports = {\n  ...,\n  plugins: [\n    ...,\n    new WebpackDeepScopeAnalysisPlugin(),\n  ],\n}\n```\n\n**Notice:** the plugin only works for `import` and `export` syntax module. If your code are transpiled to `module.export` and `require` syntax, the analyzer can't work correctly.\n\nThe plugin will analyze the scope and determine if the variables should be imported automatically.\n\n## Articles\n\n[Medium](https://medium.com/webpack/better-tree-shaking-with-deep-scope-analysis-a0b788c0ce77)\n\n[中文版](https://vincentdchan.github.io/2018/05/better-tree-shaking-with-scope-analysis/)\n\n## Pure Annotation\n\nAs you know, it's difficult for ECMAScript to analyze the side effects. Hence, `PURE` annotation is introduced, which is from [Uglify](https://github.com/mishoo/UglifyJS2):\n\n\u003e A function call is marked as \"pure\" if a comment annotation /\\*@\\_\\_PURE\\_\\_\\*/ or /\\*#\\_\\_PURE\\_\\_\\*/ immediately precedes the call. For example: /\\*@\\_\\_PURE\\_\\_\\*/foo();\n\n# Changelog\n\n### v1.7.0\n\n- Fix: #10\n\n### v1.6.1\n\n- Upgrade tslint for security issue\n- Fix: #12 : Add README to npm\n\n### v1.6.0\n\n - rename package *webpack-deep-scope-analysis* to *deep-scope-analyser*, which is published as a new npm package. It's aimed to be a standalone analyser.\n\n### v1.5.4\n\n - Fix [#7](https://github.com/vincentdchan/webpack-deep-scope-analysis-plugin/issues/7): `import * from 'xxx'` syntax\n\n### v1.5.3\n\n - Fix [#5](https://github.com/vincentdchan/webpack-deep-scope-analysis-plugin/issues/5)\n\n### v1.5.2\n\n - Improve performance and code quality\n\n### v1.5.0\n\n - Introduce `VirtualScope` to simulate module variable\n\n### v1.4.0\n\n - Fix #4\n - Publish\n\n# Contributing\n\nUse `lerna` to build and test:\n```sh\n$ lerna run build\n$ lerna run tslint\n$ lerna run test\n```\n\n# About Escope\n\nNow the `src/` includes a Typescript version of [escope](https://github.com/estools/escope),\nbecause the plugin needs some internal changes of the escope manager. So I didn't import the \nescope directly. \n\nWhen the plugin is nearly finished, I will make some PRs to the original escope repo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincentdchan%2Fwebpack-deep-scope-analysis-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvincentdchan%2Fwebpack-deep-scope-analysis-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincentdchan%2Fwebpack-deep-scope-analysis-plugin/lists"}