Package Exports
- rollup-plugin-node-builtins
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rollup-plugin-node-builtins) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
rollup-plugin-node-builtins
npm install --save-dev rollup-plugin-node-builtins
Allows the node builtins to be require
d/import
ed. Doing so gives the proper shims to support modules that were designed for Browserify.
You almost certainly need to be using this in conjunction with rollup-plugin-commonjs, rollup-plugin-node-resolve, rollup-plugin-json and rollup-plugin-node-globals.
There's no config per se, but you need to add node_modules/rollup-plugin-node-globals/**
to the commonjs
excludes
and make sure you set browser
to be true in nodeResolve
. Also it should come before nodeResolve
and globals
should come after commonjs
. For example:
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import globals from 'rollup-plugin-node-globals';
import builtins from 'rollup-plugin-node-builtins';
import json from 'rollup-plugin-json';
rollup({
entry: 'main.js',
plugins: [
builtins(),
nodeResolve({ jsnext: true, main: true, browser: true }),
commonjs({
ignoreGlobal: true
}),
globals(),
json()
]
})
The following modules include ES6 specific version which allow you to do named imports in addition to the default import. These definitely work
- process
- events
- stream
- util
- path
- buffer
- querystring
Crypto does not work at the moment