Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserify-resolutions

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-resolutions

A Browserify plugin that allows more explicit control of module deduping. It purges duplicate modules from the output bundle and prevents modules from loading several times.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
87
increased by7.41%
Maintainers
1
Weekly downloads
 
Created
Source

#browserify-resolutions build status Bower resolutions for npm + Browserify... sort of.

A Browserify plugin that allows more explicit control of module deduping. It purges duplicate modules from the output bundle and prevents modules from loading several times.

Why?

A large dependency tree may include multiple versions of the same module, which may result in it being bundled multiple times, greatly increasing the bundle's size.

What about npm dedupe?

It can be sufficient, but is sometimes hamstrung as third party modules may be asking for incompatible versions of the same library.

What about peerDependencies?

Hopefully solves this problem in the future, but currently difficult to work with: https://github.com/npm/npm/issues/6565

What about Browserify's own dedupe?

It currently only dedupes identical source files. Even if deduped, a library may be instantiated several times.

E.g., even if Angular is deduped and only bundled once, you may still see:

WARNING: Tried to load angular more than once.

How to use

Pass either an array of package names to dedupe or "*" to dedupe everything possible.

var resolutions = require('browserify-resolutions');
// Dedupe Angular
browserify(options)
  .plugin(resolutions, ['angular'])
  .bundle();
// Dedupe everything possible
browserify(options)
  .plugin(resolutions, '*')
  .bundle();

via Browserify CLI

browserify path-to-your-entry-file.js -p [ browserify-resolutions '*' ] -o path-to-your-destination.js

Keywords

FAQs

Package last updated on 21 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc