{"id":25263,"library":"esbuild-bitburner-plugin","title":"esbuild Bitburner Plugin","description":"An ESBuild plugin (v1.7.9) that uses Bitburner's Remote API to push compiled build results directly into the game. It supports automatic file uploading, file mirroring for bidirectional sync, and distribution of scripts to multiple servers. Key differentiators: seamless integration with the Bitburner editor, support for React with ingame React/ReactDOM instances, and optional Netscript definitions generation. This plugin is actively maintained and requires Node >=20.0.0.","status":"active","version":"1.7.9","language":"javascript","source_language":"en","source_url":"https://github.com/shyguy1412/esbuild-bitburner-plugin","tags":["javascript","esbuild","typescript"],"install":[{"cmd":"npm install esbuild-bitburner-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-bitburner-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-bitburner-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin hooks into esbuild's build process.","package":"esbuild","optional":false}],"imports":[{"note":"ESM-only; CommonJS require() will fail with the default export.","wrong":"const BitburnerPlugin = require('esbuild-bitburner-plugin')","symbol":"BitburnerPlugin","correct":"import { BitburnerPlugin } from 'esbuild-bitburner-plugin'"},{"note":"For dynamic imports, use ESM dynamic import.","wrong":"const BitburnerPlugin = require('esbuild-bitburner-plugin')","symbol":"BitburnerPlugin","correct":"const { BitburnerPlugin } = await import('esbuild-bitburner-plugin')"},{"note":"The default export is the plugin function; the named export is also available.","wrong":"import * as BitburnerPlugin from 'esbuild-bitburner-plugin'","symbol":"BitburnerPlugin","correct":"import BitburnerPlugin from 'esbuild-bitburner-plugin'"}],"quickstart":{"code":"import { context } from 'esbuild';\nimport { BitburnerPlugin } from 'esbuild-bitburner-plugin';\n\nconst createContext = async () => {\n  return await context({\n    entryPoints: ['servers/**/*.js', 'servers/**/*.ts'],\n    outbase: './servers',\n    outdir: './build',\n    plugins: [BitburnerPlugin({\n      port: 12525,\n      types: 'NetscriptDefinitions.d.ts',\n    })],\n    bundle: true,\n    format: 'esm',\n    platform: 'browser',\n    logLevel: 'info',\n  });\n};\n\nconst ctx = await createContext();\nctx.watch();","lang":"typescript","description":"Sets up an ESBuild context with the Bitburner plugin to watch and auto-upload scripts to the game."},"warnings":[{"fix":"Use context() with .watch() or .rebuild() instead of build().","message":"Plugin only works with esbuild's context() API; using build() directly will not trigger uploads.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to version 20.0.0 or later.","message":"Node.js >=20.0.0 is required; older versions will cause runtime errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure outdir contains subdirectories named after in-game servers.","message":"File structure in outdir determines target server; e.g., build/home/foo.js uploads to home server.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Monitor GitHub releases for deprecations.","message":"The 'types' option may be renamed in future versions; check migration guides.","severity":"deprecated","affected_versions":"1.7.x"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install esbuild-bitburner-plugin' and ensure correct import syntax.","cause":"Package not installed or wrong import path.","error":"Error: Cannot find module 'esbuild-bitburner-plugin'"},{"fix":"Use named import: import { BitburnerPlugin } from 'esbuild-bitburner-plugin'.","cause":"Using default import correctly but module returns an object.","error":"TypeError: BitburnerPlugin is not a function"},{"fix":"Kill the other process or specify a different port in the plugin options.","cause":"Port 12525 already in use by another instance.","error":"Error: listen EADDRINUSE :::12525"},{"fix":"Mark React as external: external: ['React'] in esbuild config.","cause":"React imports are expected to be resolved by the in-game React, but bundler tries to resolve locally.","error":"Build failed with 1 error: error: Could not resolve 'React'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}