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

bfred-npm-bundler

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bfred-npm-bundler

Opinionated ES6 library bundler based on rollup and buble

  • 8.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bfred-npm-bundler

Opinionated ES6 library bundler based on rollup and buble

It's for my own modules, but maybe you can find it useful too. It changes often (but follows semver). Unannounced PRs generally not welcome, but feel free to open issues to discuss first.

It outputs the following files:

  • dist/[lib-name].js
    A file for the browser with a global called [libName]
  • dist/[lib-name].min.js
    The same file as above, but minified with UglifyJS 2
  • dist/[lib-name].common-js.js
    A file to be used with browserify or similar. Set it up with:
    "main": "dist/[lib-name].common-js.js", in package.json
  • dist/[lib-name].es-modules.js
    A file to be used with ESM-aware bundlers like rollup. Set it up with:
    "module": "dist/[lib-name].es-modules.js", in package.json

Usage

Install it in your project:

npm install --save-dev bfred-npm-bundler 

Add the references to the generated files and the build step in your package.json:

{
	"main": "dist/lib-name.common-js.js",
	"module": "dist/lib-name.es-modules.js",
	"jsnext:main": "dist/lib-name.es-modules.js",
	"scripts": {
		"build": "bfred-npm-bundler lib-name libName",
		"prepublish": "npm run build"
	}
}

Node-only

If your lib only makes sense inside node/browserify, you can skip the browser file creation by not passing the second argument:

bfred-npm-bundler lib-name instead of bfred-npm-bundler lib-name libName

Byte-counting

The browser file is useful to be used for byte-counting via gzip-size-cli or with badges. If your package is node-only, you can pass the option --byte-count and a dist/[lib-name].size-measuring-only.js file will be created.

Alternatives

rollup-babel-lib-bundler is more configurable

License

MIT © Federico Brigante

FAQs

Package last updated on 01 Mar 2017

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