Registry / devops / rollup-plugin-extensions

rollup-plugin-extensions

JSON →
library0.1.0jsnpmunverified

A Rollup plugin that resolves local files with custom extensions (e.g., .tsx, .ts, .jsx). Version 0.1.0 is the only release; it is in early development with no test suite. Unlike rollup-plugin-node-resolve, it avoids resolving node_modules entirely, focusing solely on adding extension support for local imports. It is primarily intended for building packages where you control the dependency graph, and it automatically resolves index files based on the provided extensions.

npm install rollup-plugin-extensions
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-EXTE
R
rollup-plugin-extensions
devopsjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import extensions from 'rollup-plugin-extensions'
import { extensions } from 'rollup-plugin-extensions'
The package exports a default function; named import will give undefined.
default
const extensions = require('rollup-plugin-extensions')
const { extensions } = require('rollup-plugin-extensions')
CommonJS require works but destructure fails.
default
import extensions = require('rollup-plugin-extensions')
TypeScript with legacy module resolution.

Shows a basic Rollup configuration using rollup-plugin-extensions to resolve TypeScript and JSX files locally.

// rollup.config.js import extensions from 'rollup-plugin-extensions'; export default { input: 'src/index.ts', output: { file: 'dist/bundle.js', format: 'cjs', }, plugins: [ extensions({ extensions: ['.ts', '.tsx', '.js', '.jsx'], resolveIndex: true, }), ], }; // Now you can import './foo.ts' without specifying the extension in the source code.
Debug
Known issues
gotchaDefault extensions are ['.mjs', '.js']; if you need TypeScript, you must specify extensions explicitly.
fix
Provide an extensions array with desired extensions.
affects: 0.1.0
gotchaThis plugin does NOT resolve node_modules; it only resolves local imports. Using it together with rollup-plugin-node-resolve may cause unexpected behavior.
fix
Avoid combining with rollup-plugin-node-resolve unless you understand the conflict.
affects: 0.1.0
gotchaNo test suite exists; the plugin may have undiscovered bugs.
fix
Use with caution and test your build thoroughly.
affects: 0.1.0
gotchaThe plugin only handles relative imports (starting with './' or '../'). Absolute imports are not transformed.
fix
Use another plugin like rollup-plugin-alias for absolute imports.
affects: 0.1.0
Errors
Common errors & fixes
TypeError: extensions is not a function
Imported the plugin as a named export instead of default.
fix
Change import to import extensions from 'rollup-plugin-extensions'.
Error: Could not resolve './foo' from src/index.ts
Extension not included in the plugin's extensions list.
fix
Add the missing extension (e.g., '.ts') to the extensions array in the plugin configuration.
Module not found: Error: Can't resolve './bar' in '/path/to/project'
The plugin is not installed or not applied in rollup config.
fix
Install the plugin (yarn add -D rollup-plugin-extensions) and add it to the plugins array.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
rolluprequiredpeer dependency: requires Rollup ^1.4.1
Agent activity
10 hits · last 30 days
node
8
Resources
rollup-plugin-extensions — npm install rollup-plugin-extensions · libregistry