All Projects → vincentdchan → Webpack Deep Scope Analysis Plugin

vincentdchan / Webpack Deep Scope Analysis Plugin

A webpack plugin for deep scope analysis

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Webpack Deep Scope Analysis Plugin

Webpack Cdn Plugin
A webpack plugin that use externals of CDN urls for production and local node_modules for development
Stars: ✭ 306 (-48.05%)
Mutual labels:  webpack, webpack-plugin
Browser Sync Webpack Plugin
Easily use BrowserSync in your Webpack project.
Stars: ✭ 356 (-39.56%)
Mutual labels:  webpack, webpack-plugin
Filemanager Webpack Plugin
Copy, move, archive (zip/tar/tar.gz), delete files and directories before and after Webpack builds. Win32/Mac/*Nix supported
Stars: ✭ 310 (-47.37%)
Mutual labels:  webpack, webpack-plugin
Webpack Assets Manifest
This Webpack plugin will generate a JSON file that matches the original filename with the hashed version.
Stars: ✭ 269 (-54.33%)
Mutual labels:  webpack, webpack-plugin
Offline Plugin
Offline plugin (ServiceWorker, AppCache) for webpack (https://webpack.js.org/)
Stars: ✭ 4,444 (+654.5%)
Mutual labels:  webpack, webpack-plugin
Webpack Virtual Modules
Webpack Virtual Modules is a webpack plugin that lets you create, modify, and delete in-memory files in a way that webpack treats them as if they were physically presented in the file system.
Stars: ✭ 286 (-51.44%)
Mutual labels:  webpack, webpack-plugin
Webpack Extension Reloader
A upgrade from 🔥webpack-chrome-extension-reloader🔥, now on all browsers
Stars: ✭ 355 (-39.73%)
Mutual labels:  webpack, webpack-plugin
Critters
🦔 A Webpack plugin to inline your critical CSS and lazy-load the rest.
Stars: ✭ 2,894 (+391.34%)
Mutual labels:  webpack, webpack-plugin
Webpack Parallel Uglify Plugin
A faster uglifyjs plugin.
Stars: ✭ 456 (-22.58%)
Mutual labels:  webpack, webpack-plugin
Moment Locales Webpack Plugin
Easily remove unused Moment.js locales with webpack
Stars: ✭ 396 (-32.77%)
Mutual labels:  webpack, webpack-plugin
Webpack Shell Plugin
Run shell commands either before or after webpack builds
Stars: ✭ 250 (-57.56%)
Mutual labels:  webpack, webpack-plugin
Optimize Plugin
Optimized Webpack Bundling for Everyone. Intro ⤵️
Stars: ✭ 525 (-10.87%)
Mutual labels:  webpack, webpack-plugin
Webpack Messages
Beautifully format Webpack messages throughout your bundle lifecycle(s)!
Stars: ✭ 238 (-59.59%)
Mutual labels:  webpack, webpack-plugin
Webpack Sentry Plugin
Webpack plugin to upload source maps to Sentry
Stars: ✭ 299 (-49.24%)
Mutual labels:  webpack, webpack-plugin
Copy Webpack Plugin
Copy files and directories with webpack
Stars: ✭ 2,679 (+354.84%)
Mutual labels:  webpack, webpack-plugin
Web Webpack Plugin
alternative for html-webpack-plugin
Stars: ✭ 318 (-46.01%)
Mutual labels:  webpack, webpack-plugin
Unused Files Webpack Plugin
Glob all files that are not compiled by webpack under webpack's context
Stars: ✭ 210 (-64.35%)
Mutual labels:  webpack, webpack-plugin
Hard Source Webpack Plugin
www.npmjs.com/package/hard-source-webpack-plugin
Stars: ✭ 2,608 (+342.78%)
Mutual labels:  webpack, webpack-plugin
Webpack Chrome Extension Reloader
🔥 Hot reloading while developing Chrome extensions with webpack 🔥
Stars: ✭ 365 (-38.03%)
Mutual labels:  webpack, webpack-plugin
Babel Minify Webpack Plugin
[DEPRECATED] Babel Minify Webpack Plugin
Stars: ✭ 502 (-14.77%)
Mutual labels:  webpack, webpack-plugin

Webpack Deep Scope Analysis Plugin

This project is not maintained.

TLDR: This plugin will break your code, please use webpack5 instead.

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

The reason according to sokra:

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.

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

  • Fix: #10

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].