npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

webpack-deep-scope-plugin

v1.6.2

Published

![](https://travis-ci.org/vincentdchan/webpack-deep-scope-analysis-plugin.svg?branch=master) [![npm version](https://badge.fury.io/js/webpack-deep-scope-plugin.svg)](https://badge.fury.io/js/webpack-deep-scope-plugin)

Downloads

30,527

Readme

Webpack Deep Scope Analysis Plugin

npm version

A webpack plugin for deep scope analysis. It's a project of GSoC 2018 webpack organization.

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 for webpack.

Student: @Vincent Mentor: @Tobias

Demo: https://vincentdchan.github.io/webpack-deep-scope-demo/

Install

Install the plugin:

$ yarn add webpack-deep-scope-plugin

Require

  • Node.js 8 +
  • webpack 4.14.0 +

Usage

Enable the plugin in webpack.config.js:

const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin').default;

module.exports = {
  ...,
  plugins: [
    ...,
    new WebpackDeepScopeAnalysisPlugin(),
  ],
}

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.

The plugin will analyze the scope and determine if the variables should be imported automatically.

Articles

Medium

中文版

Pure Annotation

As you know, it's difficult for ECMAScript to analyze the side effects. Hence, PURE annotation is introduced, which is from Uglify:

A function call is marked as "pure" if a comment annotation /*@__PURE__*/ or /*#__PURE__*/ immediately precedes the call. For example: /*@__PURE__*/foo();

Changelog

v1.6.1

  • Upgrade tslint for security issue
  • Fix: #12 : Add README to npm

v1.6.0

  • 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.

v1.5.4

  • Fix #7: import * from 'xxx' syntax

v1.5.3

v1.5.2

  • Improve performance and code quality

v1.5.0

  • Introduce VirtualScope to simulate module variable

v1.4.0

  • Fix #4
  • Publish

Contributing

Use lerna to build and test:

$ lerna run build
$ lerna run tslint
$ lerna run test

About Escope

Now the src/ includes a Typescript version of escope, because the plugin needs some internal changes of the escope manager. So I didn't import the escope directly.

When the plugin is nearly finished, I will make some PRs to the original escope repo.