Closed LeviOP closed 10 months ago
// vite.config.ts
import { defineConfig } from 'vite';
import monkey, { util } from 'vite-plugin-monkey';
export default defineConfig({
plugins: [
monkey({
entry: 'src/main.tsx',
userscript: {
require: [
'https://openuserjs.org/src/libs/sizzle/GM_config.js',
util.dataUrl(`window.GM_config=GM_config`),
],
},
}),
],
});
// main.tsx
import { monkeyWindow } from '$';
console.log(monkeyWindow.GM_config);
谢谢
我正在尝试在vite-plugin-monkey中使用
GM_config
库。src/main.ts
vite.config.ts
在dev:
在build:
我该如何访问
GM_config
? (在dev或build)