samrum / vite-plugin-web-extension

A vite plugin for generating cross browser platform, ES module based web extensions.
MIT License
323 stars 33 forks source link

devtools panel的代码被执行两遍 #143

Open flycran opened 3 months ago

flycran commented 3 months ago

devtools panel的代码被执行了两遍,这会破坏很多事情,尤其是发送的信息被错误的代码接收。而造成这个的原因是devtools panel的构建过程不正确。manifest中devtools_page指向的devtools.html页面应该只用于使用devtools.panels.create创建devtools-panel.html页面,而后者才是真正的devtools页面。但在文档的写法中,devtools.html和devtools-panel.html被错误地合并到一个html文件,这导致其中的代码会被执行两遍

The code for the devtools panel is executed twice, which can break a lot of things, especially if the information sent is received by the wrong code. The reason for this is that the build process of the devtools panel is incorrect. The devtools.html page pointed to by devtools_page in the manifest should only be used to create the devtools-panel.html page using devtools.panels.create, and the latter is the real devtools page. However, in the way the document is written, devtools.html and devtools-panel.html are mistakenly merged into one html file, which causes the code in it to be executed twice.