{"id":12885,"library":"bili","title":"Bili: Zero-Config Library Bundler","description":"Bili is a JavaScript library bundler designed for zero-configuration setup, leveraging Rollup under the hood. It automatically handles transformations for JavaScript using Buble, Babel, or TypeScript, and includes built-in support for various CSS preprocessors like Sass, Stylus, Less, and CSS modules. The current stable version is 5.0.5, which was last published in June 2020. This project differentiates itself by aiming for a streamlined, opinionated bundling experience that minimizes boilerplate configuration, providing a user-friendly interface for building libraries with multiple output formats (CJS, ESM, UMD). Despite its initial goal of simplicity and comprehensive features, its development has ceased, leaving it without recent updates or maintenance.","status":"abandoned","version":"5.0.5","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/egoist/bili","tags":["javascript","typescript"],"install":[{"cmd":"npm install bili","lang":"bash","label":"npm"},{"cmd":"yarn add bili","lang":"bash","label":"yarn"},{"cmd":"pnpm add bili","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundling engine.","package":"rollup","optional":false},{"reason":"Used for command-line argument parsing.","package":"cac","optional":false},{"reason":"Used for loading configuration files.","package":"joycon","optional":false},{"reason":"Required if bundling TypeScript source files.","package":"typescript","optional":true},{"reason":"Recommended TypeScript plugin for type-checking during compilation, used by Bili for .ts files.","package":"rollup-plugin-typescript2","optional":true}],"imports":[{"note":"The primary programmatic API for initiating a build. Bili primarily expects ESM for its programmatic API in modern Node.js environments.","wrong":"const build = require('bili')","symbol":"build","correct":"import { build } from 'bili'"},{"note":"Utility for defining Bili configuration in `bili.config.ts` or `bili.config.js` for type safety and IntelliSense. This is a named export.","wrong":"import defineConfig from 'bili'","symbol":"defineConfig","correct":"import { defineConfig } from 'bili'"},{"note":"Importing types for configuration objects for use with TypeScript.","symbol":"Config","correct":"import type { Config } from 'bili'"}],"quickstart":{"code":"import { build, defineConfig } from 'bili';\nimport path from 'path';\nimport fs from 'fs';\n\n// CLI usage example: bili src/index.ts --format cjs,esm\n// To run this programmatically:\n\nconst projectRoot = path.resolve('./temp-bili-project');\nconst sourceFile = path.join(projectRoot, 'src', 'index.ts');\nconst configFile = path.join(projectRoot, 'bili.config.ts');\n\nfs.mkdirSync(path.join(projectRoot, 'src'), { recursive: true });\nfs.writeFileSync(sourceFile, 'export const greet = (name: string) => `Hello, ${name}!`;');\nfs.writeFileSync(configFile, `\n  import { defineConfig } from 'bili';\n  export default defineConfig({\n    input: 'src/index.ts',\n    output: {\n      format: ['cjs', 'esm'],\n      dir: 'dist',\n      fileName: '[name].[format].js',\n    },\n    plugins: {\n      typescript2: true, // Use rollup-plugin-typescript2\n    },\n  });\n`);\n\nconsole.log('Building library with Bili...');\n\nconst runBuild = async () => {\n  try {\n    // In a real scenario, you'd call build directly with your config object or let it find bili.config.ts\n    // For this example, we'll simulate the execution context assuming bili is run from projectRoot\n    await build({\n      rootDir: projectRoot,\n      configFile: configFile,\n      logLevel: 2 // 0: silent, 1: error, 2: warn, 3: info, 4: debug\n    });\n    console.log('Build complete! Check the dist folder in', projectRoot);\n    console.log(fs.readFileSync(path.join(projectRoot, 'dist', 'index.cjs.js'), 'utf-8'));\n    console.log(fs.readFileSync(path.join(projectRoot, 'dist', 'index.esm.js'), 'utf-8'));\n  } catch (error) {\n    console.error('Bili build failed:', error);\n    process.exit(1);\n  } finally {\n    // Clean up temporary files/folders for demonstration purposes\n    fs.rmSync(projectRoot, { recursive: true, force: true });\n  }\n};\n\nrunBuild();\n","lang":"typescript","description":"Demonstrates both CLI conceptual usage and a runnable programmatic build example for a TypeScript library using `bili.config.ts`."},"warnings":[{"fix":"Review the changelog for specific Rollup and plugin updates in v5.0.0 and adjust your `bili.config.js`/`.ts` or command-line arguments accordingly. Refer to the respective Rollup plugin documentation for new options or deprecated APIs.","message":"Version 5.0.0 introduced breaking changes by upgrading to the latest versions of Rollup and its plugins. This may require updating existing Bili configurations or Rollup plugin options to be compatible with the newer ecosystem.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Consider migrating to actively maintained bundlers like Rollup directly, esbuild, or Vite, which offer similar capabilities and are regularly updated.","message":"The Bili project is currently abandoned, with its last release in June 2020. This means there will be no further updates, security patches, or compatibility fixes for newer Node.js versions, Rollup versions, or other ecosystem tools. Using it in new projects or maintaining it in existing ones carries significant risk of encountering unpatched bugs or breaking incompatibilities.","severity":"breaking","affected_versions":">=5.0.5"},{"fix":"Consult the `rollup-plugin-typescript2` documentation for specific configurations related to warnings or compatibility issues. Ensure your `tsconfig.json` is correctly configured for your project's needs.","message":"Bili internally relies on `rollup-plugin-typescript2` for TypeScript bundling and type checking. Issues or warnings from this plugin, such as `objectHashIgnoreUnknownHack` warnings, can arise and may require specific configuration adjustments within your `tsconfig.json` or Bili's plugin options to suppress or resolve.","severity":"gotcha","affected_versions":">=4.9.3"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure `tsconfig.json` is correctly set up. You might be able to configure `rollup-plugin-typescript2` specifically in your `bili.config.js` to adjust its behavior or ignore certain warnings, if such options are exposed by Bili.","cause":"This warning indicates an internal heuristic used by `rollup-plugin-typescript2` might be less efficient or have unexpected behavior, often related to caching or dependency resolution with TypeScript types.","error":"rollup-plugin-typescript2: objectHashIgnoreUnknownHack warning"},{"fix":"This was a bug fixed in Bili v5.0.3. Ensure you are using Bili version `5.0.3` or newer. If the issue persists, manually configure your minifier or Rollup banner options to prevent double-injection, if Bili exposes such granular control.","cause":"Bili was observed to inject a bundle banner multiple times, particularly after minification processes, leading to redundant or malformed output files.","error":"Error: Duplicated banner after minified"},{"fix":"This was a bug fixed in Bili v5.0.5. Update Bili to version `5.0.5` or later. If custom output filenames are desired, carefully configure the `output.fileName` option in `bili.config.js` to specify the desired naming convention, e.g., `[name].[format].js`.","cause":"In some cases, Bili generated incorrect or unexpected filenames for ES module (ESM) formatted bundles, which could lead to import resolution issues.","error":"Incorrect filename for ES module format output"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"bili"}