lisonge / vite-plugin-monkey

A vite plugin server and build your.user.js for userscript engine like Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat
MIT License
1.31k stars 70 forks source link

`GM_registerMenuCommand` 无法在 dev 模式下使用 #91

Closed Sec-ant closed 1 year ago

Sec-ant commented 1 year ago

在开发这个脚本的过程中发现无法在 dev 模式下调出由 GM_registerMenuCommand 注册的 GM 脚本菜单,但是 build 后的脚本是可以的,想请教一下原因是什么?

image

lisonge commented 1 year ago

image

我这边没问题

lisonge commented 1 year ago

另外,你使用的 html-minifier-terservite serve 下不能工作

image

使用 vite-plugin-node-polyfills 可以解决这个问题

image

Sec-ant commented 1 year ago

image

我这边没问题

不好意思我检查了一下是 CSP 配置的问题,按照 https://github.com/lisonge/vite-plugin-monkey/issues/1 修改后就可以了

另外,你使用的 html-minifier-terservite serve 下不能工作

image

使用 vite-plugin-node-polyfills 可以解决这个问题

image

谢谢,已通过安装这个插件解决!