Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vite-plugin-chrome-extension

StarkShang1.9kMIT0.0.7TypeScript support: included

A plugin for building Chrome extensions!

vite-plugin, chrome extension

readme

Vite logo



vite-plugin-chrome-extension

fork from rollup-plugin-chrome-extension and evolve for vite and Chrome Extension Manifest V3

Table of Contents

Installation

npm install -D vite-plugin-chrome-extension

Usage

In vite.config.ts,

// vite.config.ts
import { resolve } from "path";
import { defineConfig } from "vite";
import { chromeExtension } from "vite-plugin-chrome-extension";

export default defineConfig({
    resolve: {
        alias: {
            "@": resolve(__dirname, "src"),
        },
    },
    build: {
        rollupOptions: {
            input: "src/manifest.json"
        }
    },
    plugins: [
        chromeExtension()
    ],
})

TODO

  • support sass/less in manifest.json

How does this plugin work

See Work flow

Examples

  • <input checked="" disabled="" type="checkbox"> Background

Examples from chrome-extensions-samples are test

Examples with Vue

Examples with Svelte

  • <input checked="" disabled="" type="checkbox"> Svelte

Feedback

If you have problems using this plugin, welcome to let us know.

Known problems

Change logs

see CHANGELOG.md

changelog

CHANGELOGS

0.0.7

  • fix: process scripts dynamically imported by chrome.scripting.executeScript;
  • fix: process styles dynamically imported by chrome.scripting.insertCSS;

0.0.6

  • fix: tracking assets in css (such as font files, images)
  • feat: add svelte example: Svelte

0.0.5

0.0.4

  • feat: upgrade bundle architecture to solve es6 import problem
  • feat: add a vue example: Vue in Content Scripts

0.0.3

0.0.2

  • feat: initial release

0.0.1

  • chore: create project