{"id":27361,"library":"rollup-plugin-skypin","title":"rollup-plugin-skypin","description":"A Rollup plugin that converts bare Node-style imports into pinned URLs from skypack.dev CDN, enabling browser-friendly ESM imports from npm packages. Version 1.1.2 is stable and actively maintained. It supports options for minified vs. normal builds, pinned URLs for production, custom replacement logic, and handling of relative/web imports. Key differentiator: lightweight, focused alternative to other CDN plugin approaches; based on skypin library.","status":"active","version":"1.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/MarshallCB/rollup-plugin-skypin","tags":["javascript","skypack","cdn","pinned","performance","npm","rollup","plugin","typescript"],"install":[{"cmd":"npm install rollup-plugin-skypin","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-skypin","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-skypin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"runtime dependency for converting package names to skypack URLs","package":"skypin","optional":false}],"imports":[{"note":"Named export, not default. Also available as require('rollup-plugin-skypin').skypin in CommonJS.","wrong":"import skypin from 'rollup-plugin-skypin'","symbol":"skypin (default)","correct":"import { skypin } from 'rollup-plugin-skypin'"},{"note":"Value import will error at runtime; use type import for TypeScript.","wrong":"import { Options } from 'rollup-plugin-skypin'","symbol":"type Options (if needed)","correct":"import type { Options } from 'rollup-plugin-skypin'"},{"note":"skypin is a function, not a class. Do not use 'new'.","wrong":"new skypin({ minified: false })","symbol":"Rollup plugin usage","correct":"skypin({ minified: false })"}],"quickstart":{"code":"// rollup.config.js\nimport { skypin } from 'rollup-plugin-skypin';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm'\n  },\n  plugins: [\n    skypin({\n      minified: true,\n      pinned: true,\n      shouldReplace: (id) => id.startsWith('some-prefix') ? id : false\n    })\n  ]\n};","lang":"typescript","description":"Showcases a Rollup configuration using the skypin plugin with options: minified, pinned URL, and custom replacement logic."},"warnings":[{"fix":"Ensure Rollup >= 1.0.0 is installed.","message":"Plugin expects Rollup v1+; may not work with older Rollup versions.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Return false to keep original behavior, or a CDN-ready URL string to replace entirely.","message":"shouldReplace returning a string replaces the module id but does NOT handle the resolution; it overrides the original id.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set relative_external: true if you have local files; false only if all imports are npm packages.","message":"relative_external option: when true, relative imports (./foo) are marked external; if false, they are processed by skypin (likely error).","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Explicitly set minified: true to preserve current behavior.","message":"Option 'minified' default true may change in future versions.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Add builtins to rollup external config or use @rollup/plugin-node-resolve with preferBuiltins: false.","message":"Plugin does not handle Node.js built-in modules; they must be externalized separately.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install skypin --save-dev","cause":"Missing dependency skypin; it is a peer dependency but not automatically installed.","error":"Error: Cannot find module 'skypin'"},{"fix":"Use named import: import { skypin } from 'rollup-plugin-skypin'","cause":"Using default import instead of named import: import skypin from 'rollup-plugin-skypin' returns undefined.","error":"TypeError: (intermediate value) is not a function"},{"fix":"In shouldReplace, check if id is an npm package name and return false for local/built-in modules.","cause":"shouldReplace returned true for a package that is not on skypack (e.g., relative path or Node built-in).","error":"Error: Could not resolve import for 'some-package'"},{"fix":"Ensure Rollup config uses format 'esm' or use rollup-plugin-skypin in a .mjs config file.","cause":"Old Rollup configuration (format 'cjs') may not handle ESM plugin correctly.","error":"Module 'rollup-plugin-skypin' resolved to a CommonJS file"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}