Skip to content

Alternative NPM Integration Strawman

Dominic Chambers edited this page Nov 18, 2015 · 4 revisions

Introduction

This page describes a simpler alternative to the BladeRunnerJS NPM Integration Strawman that will allow us to start migrating to NPM sooner.

The Plan

We have a very simple solution for bundling NPM libraries with rollup/webpack/browserify/systemjs-builder (see bundle-all-spike) that doesn't require any changes to BRJS. The bundle is simply placed into unbundled-resources, and developers refer to any libraries using npm.libX rather than require('libX').

While it would seem to be possible to use Rollup (which has a very good plugin API) to bundle BRJS libraries by creating a plugin that understood our library layouts, this would then require us to process the aliases XML files, and start bundling non-JavaScript resources parallel to any JavaScript we need to bundle. Instead, we could get Rollup to bundle more of our code by moving it to NPM, but this requires:

  1. That we finish making all dependent testing infrastructure available in NPM.
  2. That we switch to the programmatic service API — this can be still be configured with aliases in BRJS.
  3. That we provide a better inclusion story than npm.react and unbundled-resources, and that this inclusion story: 1. Doesn't require people to change how they require existing libraries since that will lead to backwards compatibility issues. 2. Allows non NPM users to continue consuming our libraries. 3. Allows NPM users to include additional NPM libraries over and above the ones we ship BRJS with.

The first two of these items were already things we were planning on working on as part of the NPM Support Milestone, so our plan now is to make these the highest priority so we can get people making increased use of NPM as soon as possible.

Clone this wiki locally