-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
102 lines (101 loc) · 2.85 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import monkey, { cdn } from 'vite-plugin-monkey';
import tsconfigPaths from 'vite-tsconfig-paths';
// import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
tsconfigPaths(),
monkey({
entry: 'src/index.tsx', // userscript entry file path
userscript: {
// name: 'linuxdo-next',
namespace: 'linuxdo-next',
// version: '0.1.0',
author: 'delph1s',
description: '一个呼吸顺畅的 linux.do 论坛',
// homepage: '',
homepageURL: 'https://github.com/delph1s/linuxdo-next',
// website: '',
// source: '',
// icon: '',
iconURL: 'https://cdn.linux.do/uploads/default/original/1X/3a18b4b0da3e8cf96f7eea15241c3d251f28a39b.png',
// defaulticon: '',
// icon64: '',
// icon64URL: '',
// updateURL: '',
// downloadURL: '',
// supportURL: '',
// include: [],
match: ['*://linux.do/', '*://linux.do/*', '*://connect.linux.do/'],
// 'exclude-match': [],
// exclude: [],
// require: [],
// resource: {},
connect: [
'connect.linux.do',
],
// sandbox: 'raw',
// antifeature: [],
// noframes: false,
// webRequest: [],
// 'inject-into': 'page',
// unwrap: false,
// greasyfork
license: 'GPLv2',
// contributionURL: '',
// contributionAmount: '1',
// compatible: '',
// incompatible: '',
'run-at': 'document-end',
grant: [
'GM_cookie',
'GM_xmlhttpRequest',
],
},
// format: {
// generate: uOptions => {
// console.log(uOptions.userscript);
// if (uOptions.mode === 'serve') {
// return '测试';
// }
// if (uOptions.mode === 'build') {
// return '打包'
// }
// if (uOptions.mode === 'meta') {
// return '元'
// }
// }
// },
// clientAlias: 'monkeyClient',
server: {
open: false,
prefix: name => {
return `${name}-dev`;
},
mountGmApi: false,
},
build: {
// fileName: 'linuxdo-next',
metaFileName: true,
externalGlobals: {
react: cdn.jsdelivr('React', 'umd/react.production.min.js'),
'react-dom': cdn.jsdelivr('ReactDOM', 'umd/react-dom.production.min.js'),
},
autoGrant: true,
// externalResource: {},
// systemjs: 'inline',
// cssSideEffects: css => {
// return (css) => {
// console.log(css);
// }
// }
},
}),
],
build: {
minify: false, // greasyfork 要求可读代码
},
});