npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@jsenv/bundling

v8.1.0

Published

generate bundles for the web or node.js

Readme

jsenv bundling

github package npm package github ci codecov coverage

Generate bundles for the web or node.js.

Table of contents

Presentation

jsenv-bundling github repository corresponds to @jsenv/bundling package published on github and npm package registries.

@jsenv/bundling can generates bundle for systemjs, commonjs or global (also known as iife). Each format takes is meant to be used in a specific way explained below.

Bundle to global

Things to know about global bundle:

  • Meant to run in a browser environment
  • Needs collision free global variable
  • Not compatible with code using dynamic import
  • Not compatible with code using top level await

For example docs/basic-project/index.js is bundled to docs/basic-project/dist/global/main.js.

That global bundle could be used by

<script src="./dist/global/main.js"></script>
<script>
  console.log(window.__whatever__)
</script>

Bundle to systemjs

Things to know about systemjs bundle:

  • Needs systemjs to be used
  • Compatible with dynamic import
  • Compatible with top level await

For example docs/basic-project/index.js is bundled to docs/basic-project/dist/systemjs/main.js.

That systemjs bundle could be used by

<script src="https://unpkg.com/[email protected]/dist/system.js"></script>
<script>
  window.System.import("./dist/systemjs/main.js").then((namespace) => {
    console.log(namespace.default)
  })
</script>

Bundle to commonjs

Things to know about commonjs bundle:

  • Meant to be required in a node.js environment
  • Not compatible with code using top level await

For example docs/basic-project/index.js is bundled to docs/basic-project/dist/commonjs/main.js.

That commonjs bundle could be used by

const exports = require("./dist/commonjs/main.js")

console.log(exports)

Code example

The following code uses @jsenv/bundling to create a systemjs bundle for index.js entry point.

const { generateSystemJsBundle } = require("@jsenv/bundling")

generateSystemJsBundle({
  projectDirectoryPath: __dirname,
  bundleDirectoryRelativePath: "./dist",
  entryPointMap: {
    main: "./index.js",
  },
})

If you want to know more about this function and others check api documentation

Concrete example

This part explains how to setup a real environment to see @jsenv/bundling in action. You will setup a basic project where you can generate different bundle formats.

Step 1 - Setup basic project

git clone [email protected]:jsenv/jsenv-bundling.git

Step 2 - Install dependencies

cd ./jsenv-bundling/docs/basic-project

If you never configured npm authentification on github registry see Configure npm authentification on github registry first.

npm install

Step 3 - Generate bundles

This project has preconfigured 3 bundle. You can generate them with the commands below:

Installation

If you never installed a jsenv package, read Installing a jsenv package before going further.

This documentation is up-to-date with a specific version so prefer any of the following commands

npm install --save-dev @jsenv/[email protected]
yarn add --dev @jsenv/[email protected]