MCPcopy Index your code
hub / github.com/StarkShang/vite-plugin-chrome-extension

github.com/StarkShang/vite-plugin-chrome-extension @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
247 symbols 852 edges 283 files 4 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<a href="#" target="_blank" rel="noopener noreferrer">
    <img width="180" src="https://github.com/StarkShang/vite-plugin-chrome-extension/raw/main/docs/icons/logo.png" alt="Vite logo">
</a>

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

Examples from chrome-extensions-samples are test

Examples with Vue

Examples with Svelte

Feedback

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

Known problems

Change logs

see CHANGELOG.md

Extension points exported contracts — how you extend this code

InversePromise (Interface)
(no doc)
__fixtures__/inversePromise.ts
ChromeExtensionManifest (Interface)
(no doc)
src/manifest.d.ts
ChromeExtensionOptions (Interface)
(no doc)
src/plugin-options.ts
WebAccessibleResource (Interface)
(no doc)
src/manifest.v2.d.ts
DynamicImportWrapperOptions (Interface)
(no doc)
src/manifest-input/dynamicImportWrapper.ts
SimpleReloaderOptions (Interface)
(no doc)
src/plugin-reloader-simple/index.ts
OutputChunkBundle (Interface)
(no doc)
src/common/models/index.ts
ManifestAsset (Interface)
(no doc)
src/validate-names/index.ts

Core symbols most depended-on inside this repo

byFileName
called by 167
__fixtures__/utils.ts
getExtPath
called by 100
__fixtures__/utils.ts
resolve
called by 42
src/manifest-input/browser/defer.ts
chromeExtension
called by 36
src/index.ts
cloneObject
called by 30
src/utils/cloneObject.ts
requireExtFile
called by 25
__fixtures__/utils.ts
simpleReloader
called by 18
src/plugin-reloader-simple/index.ts
deriveFiles
called by 15
src/manifest-input/manifest-parser/index.ts

Shape

Function 178
Method 30
Interface 23
Class 16

Languages

TypeScript100%

Modules by API surface

src/manifest-input/manifest-parser/permissions.ts46 symbols
src/processors/manifest.ts16 symbols
src/html-inputs/cheerio.ts14 symbols
src/utils/helpers.ts12 symbols
src/index.ts11 symbols
src/processors/html.ts10 symbols
src/processors/permission.ts9 symbols
__fixtures__/utils.ts7 symbols
src/processors/background/background.ts6 symbols
src/plugin-reloader-simple/index.ts6 symbols
src/plugin-options.ts6 symbols
src/manifest.d.ts6 symbols

For agents

$ claude mcp add vite-plugin-chrome-extension \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact