0.0.2 • Published 6 years ago

rollup-plugin-external-deps v0.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

rollup-plugin-external-deps Build Status

External all node modules dependencies, so they can be bundle pure project code.

Installation

npm install --save-dev rollup-plugin-external-deps

Usage

Typically, you would use this plugin alongside rollup-plugin-node-resolve, so that you could bundle your CommonJS dependencies in node_modules.

// rollup.config.js
import externals from 'rollup-plugin-external-deps';
import nodeResolve from 'rollup-plugin-node-resolve';

export default {
  input: 'main.js',
  output: {
    file: 'bundle.js',
    format: 'iife'
  },
  plugins: [
    nodeResolve({
      jsnext: true,
      main: true
    }),

    externals()
  ]
};

Strict mode

ES modules are always parsed in strict mode. That means that certain non-strict constructs (like octal literals) will be treated as syntax errors when Rollup parses modules that use them. Some older CommonJS modules depend on those constructs, and if you depend on them your bundle will blow up. There's basically nothing we can do about that.

Luckily, there is absolutely no good reason not to use strict mode for everything — so the solution to this problem is to lobby the authors of those modules to update them.

License

MIT