-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add chrome plugin
- Loading branch information
Showing
14 changed files
with
387 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { defineConfig } from 'vite'; | ||
import { resolve } from 'path'; | ||
import react from '@vitejs/plugin-react'; | ||
import copy from 'rollup-plugin-copy'; | ||
// import styleImport from 'vite-plugin-style-import'; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
base: './', | ||
resolve: { | ||
alias: { | ||
'@': resolve(__dirname, 'src'), | ||
}, | ||
}, | ||
plugins: [ | ||
|
||
/* | ||
* styleImport({ | ||
* libs: [ | ||
* { | ||
* libraryName: 'antd', | ||
* esModule: true, | ||
* resolveStyle: name => `antd/es/${name}/style/css`, | ||
* }, | ||
* ], | ||
* }), | ||
*/ | ||
react(), | ||
copy({ | ||
targets: [ | ||
{ src: 'src/manifest.json', | ||
dest: 'dist' }, | ||
{ src: 'src/assets', | ||
dest: 'dist' }, | ||
], | ||
hook: 'writeBundle', | ||
}), | ||
], | ||
build: { | ||
rollupOptions: { | ||
input: [ 'index.html', 'src/background.ts', 'src/contentScript.ts' ], | ||
output: { | ||
chunkFileNames: '[name].[hash].js', | ||
assetFileNames: '[name].[hash].[ext]', | ||
entryFileNames: '[name].js', | ||
dir: 'dist', | ||
}, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
projects/all-in-one-template/public/background/background.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>background</title> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "Vite Chrome Extension", | ||
"version": "1.0", | ||
"manifest_version": 3, | ||
"action": { | ||
"default_icon": { | ||
"16": "img/icon_16x16.png", | ||
"48": "img/icon_48x48.png", | ||
"128": "img/icon_128x128.png" | ||
}, | ||
"default_title": "Popup", | ||
"default_popup": "index.html" | ||
}, | ||
"background": { | ||
"matches": [ | ||
"http://localhost/*" | ||
], | ||
"service_worker": "background.js" | ||
}, | ||
"permissions": [], | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"http://localhost/*" | ||
], | ||
"js": [ | ||
"contentScript.js" | ||
], | ||
"run_at": "document_start", | ||
"all_frames": true | ||
} | ||
], | ||
"host_permissions": [ | ||
"https://*/" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
console.log('init background.js'); | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
console.log('init contentScript'); | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters