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

browser-pack

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-pack

pack node-style source files from a json stream into a browser bundle

  • 0.7.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by29.67%
Maintainers
1
Weekly downloads
 
Created

What is browser-pack?

The browser-pack npm package is a tool used to bundle JavaScript files for use in the browser. It takes a stream of CommonJS modules and produces a single JavaScript file that can be included in a web page. This is particularly useful for front-end development where modular code needs to be combined into a single script.

What are browser-pack's main functionalities?

Bundling JavaScript Modules

This feature allows you to bundle multiple JavaScript modules into a single file. The code sample demonstrates how to use browser-pack to read a JSON file containing module definitions, bundle them, and write the output to a new file.

const pack = require('browser-pack');
const fs = require('fs');
const JSONStream = require('JSONStream');

const p = pack();
const input = fs.createReadStream('modules.json');
const output = fs.createWriteStream('bundle.js');

input.pipe(JSONStream.parse('*')).pipe(p).pipe(output);

Customizing Bundle Output

This feature allows you to customize the output of the bundle. The code sample shows how to use options like 'raw' and 'hasExports' to modify the behavior of the bundling process.

const pack = require('browser-pack');
const fs = require('fs');
const JSONStream = require('JSONStream');

const p = pack({ raw: true, hasExports: true });
const input = fs.createReadStream('modules.json');
const output = fs.createWriteStream('custom-bundle.js');

input.pipe(JSONStream.parse('*')).pipe(p).pipe(output);

Other packages similar to browser-pack

Keywords

FAQs

Package last updated on 01 Apr 2013

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