{"id":22016,"library":"rollup-plugin-extensions","title":"rollup-plugin-extensions","description":"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.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/zelzen/rollup-plugin-extensions","tags":["javascript","rollup-plugin","rollup","extension","extensions","resolve","typescript"],"install":[{"cmd":"npm install rollup-plugin-extensions","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-extensions","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-extensions","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: requires Rollup ^1.4.1","package":"rollup","optional":false}],"imports":[{"note":"The package exports a default function; named import will give undefined.","wrong":"import { extensions } from 'rollup-plugin-extensions'","symbol":"default","correct":"import extensions from 'rollup-plugin-extensions'"},{"note":"CommonJS require works but destructure fails.","wrong":"const { extensions } = require('rollup-plugin-extensions')","symbol":"default","correct":"const extensions = require('rollup-plugin-extensions')"},{"note":"TypeScript with legacy module resolution.","wrong":"","symbol":"default","correct":"import extensions = require('rollup-plugin-extensions')"}],"quickstart":{"code":"// rollup.config.js\nimport extensions from 'rollup-plugin-extensions';\n\nexport default {\n  input: 'src/index.ts',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'cjs',\n  },\n  plugins: [\n    extensions({\n      extensions: ['.ts', '.tsx', '.js', '.jsx'],\n      resolveIndex: true,\n    }),\n  ],\n};\n// Now you can import './foo.ts' without specifying the extension in the source code.","lang":"javascript","description":"Shows a basic Rollup configuration using rollup-plugin-extensions to resolve TypeScript and JSX files locally."},"warnings":[{"fix":"Provide an extensions array with desired extensions.","message":"Default extensions are ['.mjs', '.js']; if you need TypeScript, you must specify extensions explicitly.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Avoid combining with rollup-plugin-node-resolve unless you understand the conflict.","message":"This plugin does NOT resolve node_modules; it only resolves local imports. Using it together with rollup-plugin-node-resolve may cause unexpected behavior.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Use with caution and test your build thoroughly.","message":"No test suite exists; the plugin may have undiscovered bugs.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Use another plugin like rollup-plugin-alias for absolute imports.","message":"The plugin only handles relative imports (starting with './' or '../'). Absolute imports are not transformed.","severity":"gotcha","affected_versions":"0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change import to import extensions from 'rollup-plugin-extensions'.","cause":"Imported the plugin as a named export instead of default.","error":"TypeError: extensions is not a function"},{"fix":"Add the missing extension (e.g., '.ts') to the extensions array in the plugin configuration.","cause":"Extension not included in the plugin's extensions list.","error":"Error: Could not resolve './foo' from src/index.ts"},{"fix":"Install the plugin (yarn add -D rollup-plugin-extensions) and add it to the plugins array.","cause":"The plugin is not installed or not applied in rollup config.","error":"Module not found: Error: Can't resolve './bar' in '/path/to/project'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}