Overview
CRXJS parses your extension manifest to discover entry files and configure your build. The manifest is imported into your Vite config, so you can use JSON, JavaScript, or TypeScript.Paths in the manifest are relative to your Vite project root, not to the manifest file location.
TypeScript Manifests
CRXJS exports adefineManifest helper function similar to Vite’s defineConfig. It provides autocompletion and supports dynamic or async manifest definitions.
manifest.config.ts
Manifest Paths
All paths inside the manifest are relative to your Vite project root. Use paths that start with a letter or directory name.How CRXJS Processes the Manifest
During the build, CRXJS:- Parses the manifest to find all entry files (HTML pages, content scripts, background scripts)
- Emits these files as Rollup chunks for bundling
- Transforms file references to their final output names
- Validates that the manifest uses Manifest V3 (V2 is not supported)
JSON Schema Support
For JSON manifests, use a schema for autocompletion and validation. Configure VSCode:settings.json
Dynamic Manifests
ThedefineManifest function accepts an async function with environment info:
Manifest Hooks
CRXJS provides plugin hooks for transforming the manifest:transformCrxManifest- Runs after initial parsing, before file emissionrenderCrxManifest- Runs after bundling, before final manifest output
Related
Pages
Learn about HTML pages in extensions
Background Scripts
Configure service workers
Content Scripts
Inject scripts into web pages
Web Accessible Resources
Expose extension resources