Skip to content

FezVrasta/rollup-plugin-local-resolve

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rollup-plugin-local-resolve

Resolves Node-style directories with index.js files in Rollup

Build Status Dependency Status devDependency Status Coverage Status

Rollup by default doesn't handle resolving ./folder to ./folder/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-resolve

Usage

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

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

Things to improve on

  • Check for index.js file asynchronously
  • Use absolute paths instead of relative ones to be consistent with how Rollup handles modules

License

MIT, see LICENSE for more information

About

Resolves Node-style directories with `index.js` files in Rollup

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%