{"id":27354,"library":"rollup-plugin-http-resolve","title":"rollup-plugin-http-resolve","description":"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.","status":"active","version":"4.0.1-alpha.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install rollup-plugin-http-resolve","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-http-resolve","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-http-resolve","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin interface requires Rollup >=2.0","package":"rollup","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require will fail. Use dynamic import() if needed.","wrong":"const httpResolve = require('rollup-plugin-http-resolve')","symbol":"httpResolve","correct":"import { httpResolve } from 'rollup-plugin-http-resolve'"},{"note":"Type-only import; do not use at runtime.","wrong":"import { HttpResolveOptions } from 'rollup-plugin-http-resolve'","symbol":"HttpResolveOptions","correct":"import type { HttpResolveOptions } from 'rollup-plugin-http-resolve'"}],"quickstart":{"code":"import { httpResolve } from 'rollup-plugin-http-resolve';\nimport { rollup } from 'rollup';\n\nasync function bundle() {\n  const bundle = await rollup({\n    input: 'https://example.com/module.js',\n    plugins: [\n      httpResolve({\n        cache: new Map(),\n        fallback(id) {\n          if (!id.startsWith('.')) {\n            return `https://esm.sh/${id}`;\n          }\n        }\n      })\n    ]\n  });\n  const { output } = await bundle.generate({ format: 'es' });\n  console.log(output[0].code);\n}\nbundle();","lang":"typescript","description":"Shows basic usage: resolve a remote HTTP import with optional cache and CDN fallback."},"warnings":[{"fix":"Ensure Rollup version is >=2.0 and <4.0.0, or test with Rollup 3.x.","message":"Requires Rollup >=2.0; compatibility with Rollup 3.x is untested.","severity":"breaking","affected_versions":">=4.0.0-alpha"},{"fix":"Use 3.x stable versions if available, or pin to known working alpha.","message":"Version 4.0.1-alpha.0 is an alpha release and may have unstable APIs.","severity":"deprecated","affected_versions":"4.0.1-alpha.0"},{"fix":"Use dynamic import() or convert project to ESM.","message":"ESM-only package; CommonJS require throws error.","severity":"gotcha","affected_versions":">=4.0.0-alpha"},{"fix":"Provide a cache Map in options to avoid redundant fetches.","message":"HTTP imports are not cached by default; may cause repeated network requests.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use dynamic import: const { httpResolve } = await import('rollup-plugin-http-resolve');","cause":"Using CommonJS require() to load an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported."},{"fix":"Use named import: import { httpResolve } from 'rollup-plugin-http-resolve';","cause":"Incorrect import (default import instead of named import) or mismatched Rollup version.","error":"TypeError: httpResolve is not a function or does not provide a plugin."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}