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

watchify

Package Overview
Dependencies
Maintainers
38
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

watchify

watch mode for browserify builds

  • 3.11.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
38
Created

What is watchify?

Watchify is a browserify plugin that enables fast incremental bundling. It watches your files and updates the bundle whenever any of the source files change, making it ideal for development environments where quick feedback is essential.

What are watchify's main functionalities?

Incremental Bundling

This feature allows you to set up a watch on your files so that any changes trigger a rebundling process. The code sample demonstrates how to use watchify with browserify to watch for changes in 'main.js' and update 'bundle.js' accordingly.

const watchify = require('watchify');
const browserify = require('browserify');
const fs = require('fs');

const b = browserify({
  entries: ['main.js'],
  cache: {},
  packageCache: {},
  plugin: [watchify]
});

b.on('update', bundle);
bundle();

function bundle() {
  b.bundle().pipe(fs.createWriteStream('bundle.js'));
}

Custom Watch Options

Watchify allows you to customize the watch options, such as setting a delay before rebundling. The code sample shows how to set a custom delay of 1000 milliseconds before the rebundling process starts.

const watchify = require('watchify');
const browserify = require('browserify');
const fs = require('fs');

const customOpts = {
  entries: ['main.js'],
  cache: {},
  packageCache: {},
  plugin: [watchify],
  delay: 1000 // Custom delay before rebundling
};

const b = browserify(customOpts);

b.on('update', bundle);
bundle();

function bundle() {
  b.bundle().pipe(fs.createWriteStream('bundle.js'));
}

Other packages similar to watchify

Keywords

FAQs

Package last updated on 19 Feb 2019

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