Registry / devops / gcc-ts-bundler

gcc-ts-bundler

JSON →
library0.1.8jsnpmunverified

A TypeScript bundler that uses a native Rust front-end for fast graph resolution and shim emission, with Google Closure Compiler as the final optimizer for aggressive dead code elimination and property renaming. Version 0.1.8 is current; release cadence is irregular. Key differentiators: preserves Closure's advanced optimization while moving non-Closure stages to Rust, resulting in smaller and faster output than standard TS bundlers. Supports browser-safe ESM and statically analyzable CommonJS from node_modules, lazy loading via import(), and optional chunk mode. Compatible with Vite 7 or 8 as a peer dependency.

npm install gcc-ts-bundler
INSTALL
IMPORT
SIG · GCC-TS-BUNDLER
G
gcc-ts-bundler
devopsjavascriptv0.1.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

build
import { build } from 'gcc-ts-bundler'
const { build } = require('gcc-ts-bundler')
Package is ESM-only; CommonJS require will fail. Uses native Rust addon under the hood.
cleanCache
import { cleanCache } from 'gcc-ts-bundler'
import * as bundler from 'gcc-ts-bundler'; bundler.cleanCache(...)
cleanCache is a named export, not a property of a default export.
generateExterns
import { generateExterns } from 'gcc-ts-bundler'
Use to generate Closure externs from package TypeScript hints for better optimization.

Demonstrates the basic programmatic API: building with advanced Closure optimizations and cleaning cache after build.

import { build, cleanCache } from 'gcc-ts-bundler'; const result = await build({ entries: ['./index.ts'], outDir: './dist', projectRoot: process.cwd(), srcDir: './src', compilationLevel: 'ADVANCED', }); if (result.exitCode !== 0) { console.error(result.diagnostics); process.exit(result.exitCode); } await cleanCache({ projectRoot: process.cwd() }); console.log('Build succeeded');
Debug
Known issues
breakingPackage is ESM-only; require() will throw ERR_REQUIRE_ESM.
fix
Use import syntax or dynamic import() instead of require().
affects: >=0.1.0
gotchaDynamic require() and Node builtins are rejected when packages.mode is 'esm-only' (default).
fix
Use static imports and avoid Node-specific modules if targeting browsers.
affects: >=0.1.0
gotchaLazy loading via import() only works with string literals; computed specifiers are not supported.
fix
Ensure import() arguments are plain string literals.
affects: >=0.1.0
deprecatedchunks.mode defaults to 'off'; setting 'bundler-runtime' may change output structure significantly.
fix
Only enable chunk mode if you understand the bootstrap/script split behavior.
affects: >=0.1.0
gotchaCache is persistent by default and lives outside the user project; may cause stale builds.
fix
Use cleanCache() or set cache.mode to 'volatile' to disable persistence.
affects: >=0.1.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Using CommonJS require() to load the ESM-only package.
fix
Switch to import syntax or use dynamic import() in a CommonJS context.
TypeError: build is not a function
Importing build as default export instead of named export.
fix
Use `import { build } from 'gcc-ts-bundler'` (curly braces).
Error: Unsupported module type: JSON module
Attempting to import a JSON file; the bundler does not support JSON modules.
fix
Preprocess JSON to JavaScript or use a different bundler for JSON support.
Error: Dynamic require not allowed: require('...')
Using dynamic require() in source code with default 'esm-only' packages mode.
fix
Replace require() with static import or set packages.mode to include CommonJS.
Upgrade
Version history
0.1.8latest on npm
Audit
Dependencies
viteoptionalPeer dependency required for integration
Agent activity
2 hits · last 30 days
node
2
Resources
gcc-ts-bundler — npm install gcc-ts-bundler · libregistry