chrome-extension-tools
Build cross-browser extensions with native HMR and zero-config setup
Top Related Projects
Next generation frontend tooling. It's fast!
Quick Overview
CRXJS Chrome Extension Tools is a set of utilities designed to simplify the development of Chrome extensions using modern web technologies. It provides a seamless integration with Vite, allowing developers to build extensions using frameworks like React, Vue, and Svelte with hot module replacement (HMR) support.
Pros
- Enables the use of modern web frameworks and tools for Chrome extension development
- Supports hot module replacement (HMR) for faster development cycles
- Integrates well with Vite, leveraging its speed and efficiency
- Simplifies the build process for Chrome extensions
Cons
- Limited to Chrome extensions, not applicable for other browser extension development
- Requires familiarity with Vite and modern JavaScript tooling
- May have a learning curve for developers used to traditional extension development methods
- Documentation could be more comprehensive for advanced use cases
Code Examples
- Basic Vite configuration for a Chrome extension:
// vite.config.js
import { defineConfig } from 'vite'
import { crx } from '@crxjs/vite-plugin'
import manifest from './manifest.json'
export default defineConfig({
plugins: [crx({ manifest })],
})
- Using React with CRXJS:
// popup.jsx
import React from 'react'
import ReactDOM from 'react-dom/client'
import Popup from './Popup.jsx'
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<Popup />
</React.StrictMode>
)
- Content script injection:
// content.js
console.log('Content script loaded')
document.body.style.backgroundColor = 'lightblue'
Getting Started
-
Install CRXJS in your project:
npm install @crxjs/vite-plugin -D -
Create a
manifest.jsonfile for your extension. -
Set up your
vite.config.jsfile:import { defineConfig } from 'vite' import { crx } from '@crxjs/vite-plugin' import manifest from './manifest.json' export default defineConfig({ plugins: [crx({ manifest })], }) -
Run the development server:
npm run dev -
Load the
distfolder as an unpacked extension in Chrome for testing.
Competitor Comparisons
Next generation frontend tooling. It's fast!
Pros of Vite
- Broader ecosystem support and larger community
- Faster build times and hot module replacement
- More flexible and can be used for various project types beyond extensions
Cons of Vite
- Requires additional configuration for Chrome extension development
- Less specialized features for extension-specific workflows
- May have a steeper learning curve for extension developers
Code Comparison
Chrome Extension Tools:
import { crx } from '@crxjs/vite-plugin'
import manifest from './manifest.json'
export default {
plugins: [crx({ manifest })]
}
Vite:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()]
})
Summary
Chrome Extension Tools is specifically designed for Chrome extension development, offering a more streamlined experience for this use case. It provides out-of-the-box support for extension-specific features and workflows.
Vite, on the other hand, is a more general-purpose build tool with broader applications. It offers faster build times and a larger ecosystem but requires additional setup for Chrome extension development.
The choice between the two depends on the project's specific needs and the developer's familiarity with each tool. Chrome Extension Tools may be more suitable for dedicated extension projects, while Vite might be preferred for its versatility and performance in various web development scenarios.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME

CRXJS
Build cross-browser extensions with native HMR and zero-config setup
ð Documentation | ð¬ Discord
ð¦ Create CRXJS Project
npm create crxjs@latest
[!IMPORTANT]
@latestMUST NOT be omitted, otherwisenpmmay resolve to a cached and outdated version of the package.
⨠Features
- ð§© Full Vite Plugin Ecosystem - Leverage any Vite-compatible plugins with zero extra setup
- âï¸ Zero Configuration - Start developing immediately with intelligent defaults
- 3ï¸â£ Manifest V3 Support - Built for modern Chrome extensions with enhanced security
- ð¥ True Hot Module Replacement - Instant UI updates while preserving extension state ðworks with content scripts
- ð Static Asset Import - Directly reference images/fonts in your code
- ð¤ Auto Web-Accessible Resources - Automatic generation of
web_accessible_resourcesmanifest entries
[!NOTE]
Looking for MV2 support? Seerollup-plugin
ð» Development
- Clone this repository
- Install pnpm
- Install dependencies using
pnpm install - Build the
vite-pluginproject usingpnpm build:vite-plugin - Playgrounds project is located at
playgrounds/**, usingpnpm playcan run the playgrounds - Cd into the
vite-plugindirectory usingcd packages/vite-plugin - Test using
pnpm run test - Use DeepWiki to learn more about CRXJS
ð Contributors
This project exists thanks to all the people who contribute.
And thank you to all our backers! ð
ð¤ Supporting
If these plugins have helped you ship your product faster, please consider sponsoring me on GitHub.
Top Related Projects
Next generation frontend tooling. It's fast!
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot