-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
60 lines (56 loc) · 1.65 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
// https://vitejs.dev/config/
const name = "Idle Pixel Fixed";
const namespace = "com.kape142.idlepixelfixed";
const version = "1.0.8";
const description = "Extension to improve the experience of Idle Pixel";
const author = "kape142";
const match = "https://idle-pixel.com/login/play/*";
const grant = "none";
const requires = [
"https://unpkg.com/react@17/umd/react.production.min.js",
"https://unpkg.com/react-dom@17/umd/react-dom.production.min.js",
"https://unpkg.com/@reduxjs/toolkit@1.8.5/dist/redux-toolkit.umd.min.js",
"https://unpkg.com/react-redux@8.0.2/dist/react-redux.js",
];
const fullText = `// ==UserScript==
// @name ${name}
// @namespace ${namespace}
// @version ${version}
// @description ${description}
// @author ${author}
// @match ${match}
// @grant ${grant}
${requires.reduce((acc, cur) => acc + `// @require ${cur}\n`, "")}
// ==/UserScript==
`;
export default defineConfig({
plugins: [],
esbuild: {
legalComments: "inline",
banner: fullText,
},
build: {
outDir: "greasyfork",
minify: false,
lib: {
entry: resolve(__dirname, "src/main.tsx"),
name: "Idle Pixel Fixed",
formats: ["umd"],
fileName: (format) => `ipFixed.${format}.js`,
},
rollupOptions: {
external: ["react", "react-dom", "@reduxjs/toolkit", "react-redux"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
"react-redux": "ReactRedux",
"@reduxjs/toolkit": "RTK",
},
},
},
},
});