rollup-plugin-node-resolve-magic
v0.2.11
Published
Rollup.js plugin which resolves third-party dependencies in node_modules
Downloads
31
Maintainers
Readme
rollup-plugin-node-resolve-magic
Locate modules using the Node resolution
algorithm, for using
third party modules in node_modules
. Differs in the following ways from
rollup-plugin-node-resolve:
- Automatically degrades from 'module' -> 'jsnext:main' -> 'main' -> 'index.js'
- Correctly resolves symlinked packages.
- Prefers entry-module basedir as basedir for resolution (ideal for bundled apps, prevents duplication of shared modules).
Originally developed as part of Handroll.
Install
$ npm install rollup-plugin-node-resolve-magic --save-dev
Usage
Add the following code to your project's rollup.config.js
:
import nodeResolve from 'rollup-plugin-node-resolve-magic';
export default {
entry: 'index.js',
plugins: [
nodeResolve({
// defaults
basedir: path.dirname('index.js'),
browser: false,
extensions: ['.js', '.json', '.coffee', '.pug', '.styl'],
preferBuiltins: true,
skip: []
})
]
};
License
MIT