1.1.1 • Published 6 years ago

rollup-plugin-local-resolving v1.1.1

Weekly downloads
103
License
MIT
Repository
github
Last release
6 years ago

rollup-plugin-local-resolving

Resolves Node-style directories with index.js files in Rollup. This is forked from https://github.com/frostney/rollup-plugin-local-resolve.

Build Status dependencies Status devDependencies Status Coverage Status

Rollup by default doesn't handle resolving ./module to ./module.js or ./module/index.js internally. While there is the rollup-plugin-node-resolve plugin which also resolves directories as well as all dependencies from the node_modules directory, these may sometimes be too much for the use case at hand.

Installation

$ npm install rollup-plugin-local-resolving

Usage

import { rollup } from 'rollup';
import localResolve from 'rollup-plugin-local-resolving';

// This will resolve `./files` to `./files.js` or `./files/index.js` if the file exists
rollup({
  entry: './files',
  plugins: [localResolve()],
});

Options:

{
  // `extensions` is an optional array with all extensions expected to be resolved. Defaults to ['.js'] when omited.
  extensions: ['.js', '.jsx']
}

Things to improve on

  • Check for index.js file asynchronously

License

MIT, see LICENSE for more information