JSPM

rollup-plugin-extensions

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 793
  • Score
    100M100P100Q89820F
  • License MIT

Allow rollup to resolve local files with any extension

Package Exports

  • rollup-plugin-extensions

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-extensions) 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-extensions

Allow rollup to resolve local files with any extension.

Installation

yarn add -D rollup-plugin-extensions

Usage

// rollup.config.js
import extensions from 'rollup-plugin-extensions';

export default {
  input: 'main.js',
  output: {
    file: 'bundle.js',
    format: 'cjs',
  },
  plugins: [
    extensions({
      // Supporting Typescript files
      // Uses ".mjs, .js" by default
      extensions: ['.tsx', '.ts', '.jsx', '.js'],
      // Resolves index dir files based on supplied extensions
      // This is enable by default
      resolveIndex: true,
    })
  ]
};

Why

Plugins like rollup-plugin-node-resolve can cause issues, if you're building a package, by trying to resolve files in node_modules.
This package strives to have a minimal use case and is primarily focused on adding extension support.

If you need additional features like aliasing, commonjs support, or fully supported nodejs style resolutions try these packages:

Todo

    • Testing Suite

"Inspired" by Oskar