Giter VIP home page Giter VIP logo

vite-plugin-crx-mv3's Introduction

vite-plugin-crx-mv3

Build a Chrome Extension with Vite.

English | 简体中文

Features

  • Support Manifest V3.
  • Support Typescript.
  • Support sass/less in manifest.json.
  • Support for multiple frameworks or libraries, such as vue, react, etc.
  • Live Reload
  • Easy to get started

Usage

Install

# npm
npm install vite-plugin-crx-mv3 -D
# or yarn
yarn add vite-plugin-crx-mv3 -D
# or pnpm
pnpm add vite-plugin-crx-mv3 -D

Plugin options

port

  • Type: number
  • Default: 8181

Create a websocket connection. Notify Chrome extension clients to reload when changes are made to the content_scripts and service_worker files.

manifest

  • Type: string
  • Required : true

Path to the chrome extension's manifest.json

reloadPage

  • Type: blooen
  • Default : true

Control automatic page loading in dev environment

Configuration

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import crx from 'vite-plugin-crx-mv3'

export default defineConfig({
  plugins: [
    vue(),
    crx({
      manifest: './src/manifest.json'
    }),
  ],
})

Run

# development
npm run dev
# production
npm run build

Examples

Check out the examples in this repo.

  • crx-basic
  • crx-vue
  • crx-vue-drawer
  • crx-vue-multi-page
  • crx-vue-antd-bookmarks
  • crx-react
  • crx-react-sandbox
  • crx-solid
  • crx-newtab
  • crx-contentscript-sass-less
  • crx-chrome.script
  • crx-i18n
  • crx-devtools
  • crx-webAccessibleResources

Preview

examples/crx-vue-drawer

Notes

  • After starting the project, you need to refresh the page manually for the first time, so that the client and the server can establish a websocket connection.
  • The html file needs to be placed outside the src directory.

vite-plugin-crx-mv3's People

Contributors

jervis2049 avatar makotoatsu avatar s836064858 avatar mammad2c avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.