{"id":21337,"library":"fib-rollup","title":"fib-rollup","description":"A wrapper for running Rollup inside fibjs, a JavaScript runtime optimized for async I/O with coroutines. Version 0.4.0 allows using Rollup's JavaScript API with top-level await in fibjs's coroutine context. It provides a patched virtual machine (vbox) to emulate Node.js 'module' and other globals, enabling many Rollup plugins to run despite fibjs lacking full Node.js compatibility. Key differentiators: integrates Rollup's ES module bundling with fibjs's fiber-based concurrency; includes an internal 'rollup-plugin-fibjs-resolve' plugin as a fibjs-compatible alternative to 'rollup-plugin-node-resolve'. Limitations: not all Rollup plugins work, and CLI support is planned but not yet implemented.","status":"active","version":"0.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/fibjs/fib-rollup","tags":["javascript","fibjs","rollup","typescript"],"install":[{"cmd":"npm install fib-rollup","lang":"bash","label":"npm"},{"cmd":"yarn add fib-rollup","lang":"bash","label":"yarn"},{"cmd":"pnpm add fib-rollup","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"fib-rollup exports a default object containing rollup and plugins. Use destructured default import.","wrong":"const rollup = require('fib-rollup')","symbol":"rollup","correct":"import { default as rollup } from 'fib-rollup'"},{"note":"The plugins object includes internal plugins like 'rollup-plugin-fibjs-resolve'. Available as named export.","wrong":"const plugins = require('fib-rollup').plugins","symbol":"plugins","correct":"import { plugins } from 'fib-rollup'"},{"note":"Utilities like vbox are exported under the 'utils' namespace. Direct subpath imports may not work.","wrong":"const utils = require('fib-rollup/utils')","symbol":"utils","correct":"import { utils } from 'fib-rollup'"}],"quickstart":{"code":"const path = require('path');\nconst { default: rollup, plugins } = require('fib-rollup');\n\nasync function build() {\n    const bundle = await rollup.rollup({\n        input: './src/index.js',\n        plugins: [\n            plugins['rollup-plugin-fibjs-resolve']()\n        ]\n    }).catch(e => console.error(e));\n\n    if (bundle) {\n        const { code } = await bundle.generate({ format: 'cjs' }).catch(e => console.error(e));\n        console.log(code);\n    }\n}\n\nbuild();","lang":"javascript","description":"Demonstrates using fib-rollup to bundle a JavaScript file with the fibjs-resolve plugin, generating CommonJS output."},"warnings":[{"fix":"Use only plugins known to work (e.g., rollup-plugin-commonjs) or test with fibjs's vbox. See plugin compatibility list in the docs.","message":"Not all Rollup plugins are compatible with fibjs due to missing Node.js APIs.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"If a plugin fails, try using the provided vbox.getCustomizedVBox to patch missing modules.","message":"fib-rollup uses a custom module resolution; some plugin imports may fail.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Upgrade fibjs to version >=0.26.1 or wrap code in an async function.","message":"Top-level await is only supported in fibjs >=0.26.1.","severity":"gotcha","affected_versions":"<0.26.1"},{"fix":"Use the programmatic API as shown in the quickstart.","message":"CLI mode is not implemented; only JavaScript API is available.","severity":"gotcha","affected_versions":"<=0.4.0"}],"env_vars":null,"search_vec":"'0.4.0':21 'allow':22 'altern':93 'api':27 'async':16 'await':32 'base':77 'bundl':71 'cli':107 'compat':63,92 'concurr':78 'context':37 'coroutin':19,36 'despit':58 'differenti':65 'emul':46 'enabl':52 'es':69 'fib':2 'fib-rollup':1 'fiber':76 'fiber-bas':75 'fibj':10,34,59,73,85,91,116 'fibjs-compat':90 'full':61 'global':51 'i/o':17 'implement':114 'includ':79 'insid':9 'integr':66 'intern':81 'javascript':12,26,115 'key':64 'lack':60 'level':31 'limit':100 'machin':43 'mani':53 'modul':48,70 'node':98 'node.js':47,62 'optim':14 'patch':41 'plan':110 'plugin':55,84,87,97,104 'provid':39 'resolv':86,99 'rollup':3,8,24,54,67,83,96,103,117 'rollup-plugin-fibjs-resolv':82 'rollup-plugin-node-resolv':95 'run':7,57 'runtim':13 'support':108 'top':30 'top-level':29 'typescript':118 'use':23 'vbox':44 'version':20 'virtual':42 'work':105 'wrapper':5 'yet':113","created_at":"2026-04-27T16:59:22.634700+00:00","updated_at":"2026-04-27T16:59:22.634700+00:00","problems":[{"fix":"Use 'rollup-plugin-fibjs-resolve' (built-in) instead.","cause":"The plugin is not compatible with fibjs's module system.","error":"Error: Cannot find module 'rollup-plugin-node-resolve'"},{"fix":"Ensure your script runs inside the vbox by using 'vbox.require' or the default rollup export.","cause":"fibjs lacks the Node.js 'module' module.","error":"TypeError: module is not a function"},{"fix":"Wrap your code in an async function or upgrade fibjs.","cause":"fibjs version <0.26.1 does not support top-level await.","error":"SyntaxError: await is only valid in async function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/fibjs/fib-rollup","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/fib-rollup","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}