Registry / http-networking / rollup-plugin-http-resolve

rollup-plugin-http-resolve

JSON →
library4.0.1-alpha.0jsnpmunverified

A Rollup plugin that resolves imports via HTTP(S) URLs, enabling bundling of code from CDNs like esm.sh or unpkg. Current version 4.0.1-alpha.0 has irregular release cadence (last release ~2022). Key differentiator: it allows Rollup to fetch and bundle dependencies directly from HTTP sources, with optional caching and fallback to CDN resolution. Requires Node.js 14+. Written in TypeScript with built-in types.

npm install rollup-plugin-http-resolve
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-HTTP
R
rollup-plugin-http-resolve
http-networkingjavascriptv4.0.1-alpha.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

httpResolve
import { httpResolve } from 'rollup-plugin-http-resolve'
const httpResolve = require('rollup-plugin-http-resolve')
ESM-only package; CommonJS require will fail. Use dynamic import() if needed.
HttpResolveOptions
import type { HttpResolveOptions } from 'rollup-plugin-http-resolve'
import { HttpResolveOptions } from 'rollup-plugin-http-resolve'
Type-only import; do not use at runtime.

Shows basic usage: resolve a remote HTTP import with optional cache and CDN fallback.

import { httpResolve } from 'rollup-plugin-http-resolve'; import { rollup } from 'rollup'; async function bundle() { const bundle = await rollup({ input: 'https://example.com/module.js', plugins: [ httpResolve({ cache: new Map(), fallback(id) { if (!id.startsWith('.')) { return `https://esm.sh/${id}`; } } }) ] }); const { output } = await bundle.generate({ format: 'es' }); console.log(output[0].code); } bundle();
Debug
Known issues
breakingRequires Rollup >=2.0; compatibility with Rollup 3.x is untested.
fix
Ensure Rollup version is >=2.0 and <4.0.0, or test with Rollup 3.x.
affects: >=4.0.0-alpha
deprecatedVersion 4.0.1-alpha.0 is an alpha release and may have unstable APIs.
fix
Use 3.x stable versions if available, or pin to known working alpha.
affects: 4.0.1-alpha.0
gotchaESM-only package; CommonJS require throws error.
fix
Use dynamic import() or convert project to ESM.
affects: >=4.0.0-alpha
gotchaHTTP imports are not cached by default; may cause repeated network requests.
fix
Provide a cache Map in options to avoid redundant fetches.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
Using CommonJS require() to load an ESM-only package.
fix
Use dynamic import: const { httpResolve } = await import('rollup-plugin-http-resolve');
TypeError: httpResolve is not a function or does not provide a plugin.
Incorrect import (default import instead of named import) or mismatched Rollup version.
fix
Use named import: import { httpResolve } from 'rollup-plugin-http-resolve';
Upgrade
Version history
4.0.1-alpha.0latest on npm
Audit
Dependencies
rolluprequiredpeer dependency; plugin interface requires Rollup >=2.0
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-http-resolve — npm install rollup-plugin-http-resolve · libregistry