Skip to content

Simple vite plugin to reload chrome extension on file change for manifest v3.

License

Notifications You must be signed in to change notification settings

tyler-sydecar/vite-pilot

 
 

Repository files navigation

Node.js CI

Hot Reload Chrome Extension - Vite Plugin

image

This Vite plugin offers an effortless solution for seamlessly refreshing a Chrome extension built on Manifest V3. With this plugin, you can streamline the development and testing process, ensuring your extension stays up-to-date without manual intervention.

Inspired by stackoverflow answer and other similar repos.

Screen.Recording.2023-10-28.at.14.06.31.mov

Usage

Install

$ npm i hot-reload-extension-vite -D

configuration

import hotReloadExtension from 'hot-reload-extension-vite';

export default {
  plugins: [
    hotReloadExtension({
      log: true,
      backgroundPath: 'path/to/background' // src/pages/background/index.ts
    })
  ]
};

Then run

$ NODE_ENV=development vite build --watch  // Override NODE_ENV

Extension will only reload when NODE_ENV is 'development'

Example Project

Link

Options

Options Type Description
log boolean (optional) Logs error and info.
backgroundPath string (required) Path to background service worker file.

Env variables

Variable default Description
HOT_RELOAD_EXTENSION_VITE_PORT 8080 Web socket port

License

MIT

About

Simple vite plugin to reload chrome extension on file change for manifest v3.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 60.7%
  • CSS 18.2%
  • Vue 15.0%
  • HTML 6.1%