A powerful auto-builder and bundler for Counter-Strike 2 scripts that enables modern development workflow with TypeScript support, module imports, and automatic bundling.
- Module System: Import and export code across multiple files
- Auto-bundling: Automatically combines all files into a single bundle
- TypeScript Support: Full TypeScript intellisense and type checking
- Hot Reload: Watches for file changes and rebuilds automatically
- CS2 Integration: Direct output to your CS2 addon scripts folder
- Node.js (Download and install from official website)
- Counter-Strike 2
- Basic knowledge of JavaScript/TypeScript
Download the archive and extract it to a convenient location (NOT inside your addon folder).
Download and install Node.js from the official website if you haven't already.
Create a new addon in CS2 if you haven't done so already.
Create a scripts folder in your addon directory. For example:
E:\steam\steamapps\common\Counter-Strike Global Offensive\content\csgo_addons\cs2builder\scripts
- Open
tsconfig.jsonin the CS2 Script Builder folder - Update the
outDirpath to point to your addon's scripts folder:
{
"compilerOptions": {
"outDir": "E:/steam/steamapps/common/Counter-Strike Global Offensive/content/csgo_addons/cs2builder/scripts"
}
}Open a terminal/command prompt in the CS2 Script Builder folder and run:
npm installNote: This only needs to be done once during initial setup.
- Navigate to the
srcfolder - Create your first file, for example
main.ts - Write your CS2 script code with full TypeScript support
Example main.ts:
// Your CS2 script code here
import { Instance } from 'cs_script/point_script'
Instance.ServerCommand("say hello from JS!")Run start.bat to start the file watcher. This will:
- Monitor your source files for changes
- Automatically rebuild the project when files are modified
- Generate a
bundle.vjsfile in your scripts folder
- In your CS2 map editor, add a
point_scriptentity - Set the script file to
bundle.vjs - Configure any other necessary entity properties
- Build your map
- Test your scripts in-game
- Make changes to your TypeScript files and they'll automatically rebuild
CS2-Script-Builder/
├── src/ # Your TypeScript source files
│ ├── types/ # Type definitions
│ └── main.ts # Your main script file
├── builder/ # Build system files
├── tsconfig.json # TypeScript configuration
├── package.json # Project dependencies
├── start.bat # Development server launcher
└── README.md # This file
- Write your code in the
srcfolder using TypeScript - Import/export modules as needed across multiple files
- The builder automatically combines everything into
bundle.vjs - Test changes immediately in CS2
For a visual walkthrough of the setup process, watch our tutorial: https://youtu.be/Un05KbKqGfU
https://github.com/zephire1/CS2-Script-Builder/wiki/cs2-builder-library-API
// utils.ts
export function myUtility() {
return "Hello from utility!";
}
// main.ts
import { Instance } from 'cs_script/point_script'
import { myUtility } from './utils'
Instance.Msg(myUtility())- Full IntelliSense and autocomplete
- Type checking at compile time
- Modern ES6+ features
- Custom type definitions for CS2
- File watcher monitors source changes
- Instant rebuilding on save
- No manual build steps required
Build not working?
- Ensure Node.js is properly installed
- Check that
npm installcompleted successfully - Verify the
outDirpath intsconfig.jsonis correct
Feel free to submit issues and enhancement requests!