Skip to content

ChrisBarnes2000-VSCodeChrome-Extensions/Vue-Chrome-Extension-Template

Repository files navigation

mv3-vue-chrome-extension-template

chrome-extension development template with firebase

Support

  • Chrome Extension
  • Manifest V3
  • Vue3
  • Typescript
  • Hot Reload
  • Firebase Authentication

Quick Start

Install

git clone https://github.com/munron/mv3-vue-chrome-extension-template.git
cd mv3-vue-chrome-extension-template
npm install
npm run build
mv .env.sample .env

Fix Extension ID

Open chrome://extensions

Click Pack Extension

Click Browse and select dist folder

dist.crx and dist.pem are generated.

Edit .env

Copy private key from dist.pem and paste to VUE_APP_MV3_KEY

VUE_APP_FIREBASE_APIKEY=XXXXXXXX
VUE_APP_FIREBASE_AUTHDOMAIN=XXXXXXXX
VUE_APP_FIREBASE_PROJECTID=XXXXXXXX
VUE_APP_FIREBASE_STORAGEBUCKET=XXXXXXXX
VUE_APP_FIREBASE_MESSAGINGSENDERID=XXXXXXXX
VUE_APP_FIREBASE_APPID=XXXXXXXX
VUE_APP_MEASUREMENTID=XXXXXXXX
VUE_APP_OAUTH2_CLIENT_ID=XXXXXXXX
VUE_APP_MV3_KEY="-----BEGIN PRIVATE KEY-----\nXXXXX.....XXXXXX\n....\nXXXXXX.....XXXXXXX\n-----END PRIVATE KEY-----"

Setup Firebase

Create New Project

https://console.firebase.google.com

Copy Firebase Configuration to .env

const firebaseConfig = {
   apiKey: "XXX",
   authDomain: "XXX",
   projectId: "XXX",
   storageBucket: "XXX",
   messagingSenderId: "XXX",
   appId: "XXX",
   measurementId: "XXX"
};

Add Google to Sign-in provider

Build → Authentication → Sign-in method → Google → Save

Add domain

Build → Authentication → Settings → Add domain
domain: chrome-extension://{Chrome Extension ID}

Setup Google Cloud Platform

Open API&Service → Credential → +CREATE CREDENTIALS → OAuth Client ID

Select Chrome App, fill Name and Application ID (Chrome Extension ID)

Edit .env.

Copy Your Client Id to VUE_APP_OAUTH2_CLIENT_ID

Edit rollup.config.js.

Uncomment oauth2 settings.

chromeExtension({
  extendManifest: {
    "oauth2": {
      "client_id": process.envVUE_APP_OAUTH2_CLIENT_ID,
      "scopes": [
        "https://www.googleapis.com/authuserinfo.email",
        "https://www.googleapis.com/authuserinfo.profile"
      ]
    },
    "key": process.env.VUE_APP_MV3_KEY
  }
}),

Build

npm run build

Hot reload

npm run dev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published