CRX Compiler

raw JSON →
1.1.3 verified Fri May 01 auth: no javascript

CRX Compiler is a CLI tool for building and signing Chrome extensions. It automates TypeScript compilation, packaging into CRX/ZIP formats, and key generation for signing. Current stable version 1.1.3. Designed for developers who need a simple, all-in-one build pipeline for Chrome extensions without manual steps. Differentiators: built-in tsconfig generation, key generation in RSA 2048, and both CRX and ZIP output. Ships TypeScript declarations for API usage.

error Error: ENOENT: no such file or directory, open 'pre_dist/manifest.json'
cause The pre_dist directory does not contain manifest.json, possibly because crx-precompile wasn't run or manifest is in src.
fix
Run crx-precompile or specify manifest path via --manifest.
error TypeError: crx-compiler is not a function
cause Attempting to import crx-compiler as a Node.js module when it is a CLI tool.
fix
Use npx or install globally: npm install -g crx-compiler.
error crx-tsconfig: command not found
cause crx-tsconfig alias is not recognized in newer versions; use crx-tsc-init.
fix
Use crx-tsc-init instead of crx-tsconfig.
error Error: Private key not found
cause The specified key file does not exist at the given path.
fix
Generate keys first with crx-keygen or provide correct path to existing key.
gotcha crx-compiler requires Node.js 14+ and npm 6+.
fix Update Node.js to 14 or later, npm to 6 or later.
gotcha Key generation uses RSA 2048; public key must be added to manifest.json as 'key' field (base64 without headers).
fix After crx-keygen, read public_key.pem, convert to base64, and add to manifest.json.
deprecated crx-tsconfig alias is deprecated. Use crx-tsc-init instead.
fix Replace crx-tsconfig with crx-tsc-init.
gotcha The --clean flag (uppercase -C) deletes both pre_dist and dist directories; lowercase -c is used for --only-crx. Confusing.
fix Use -C for clean all, -c for only CRX.
gotcha If key file is missing, crx-compiler fails with an error. Ensure key.pem exists or use --key-file to specify.
fix Run crx-keygen first or provide path to existing private key.
npm install crx-compiler
yarn add crx-compiler
pnpm add crx-compiler

Complete build pipeline: init TS config, precompile, generate keys, and build CRX+ZIP with cleanup.

npx crx-tsc-init -i src -o pre_dist && npx crx-precompile -s src -p pre_dist -c && npx crx-keygen key.pem public.pem && npx crx-compiler -s src -p pre_dist -d dist -k key.pem -C