Jervis2049 / vite-plugin-crx-mv3

Build a Chrome Extension with Vite⚡
201 stars 30 forks source link

newtab.html 不能用vue构建 #23

Closed xtgcs closed 1 year ago

xtgcs commented 1 year ago

如何既支持覆盖浏览器起始页也支持内嵌页面,目前打包不支持,newtab.html 不能用vue构建

Jervis2049 commented 1 year ago

examples/crx-vue-multi-page 这有个多页面的例子,不能满足这个需求吗?newtab.html 也可以用vue构建的。或者,给我提供一个demo,让我更清楚您的需求 。

xtgcs commented 1 year ago

我就用的这个模版,newtab.html如何用vue构建呢,大佬方便给个具体例子吗,我需要开发一个扩展,覆盖浏览器起始页,同时他也部分功能也支持内嵌到第三方网页,覆盖浏览器扩展的这个页面,可以单独部署一个web版本。

Jervis2049 commented 1 year ago

newtab.html用vue构建的话,你试下参考那个模板下popup。

  1. 复制一份src/popup目录,然后改名为newtab。
  2. newtab.html
    <div id="app"></div>
    <script type="module" src="./src/newtab/main.ts"></script>

    3.manifest

    "chrome_url_overrides" : { 
    "newtab": "../newtab.html" 
    },
xtgcs commented 1 year ago

谢大佬

xtgcs commented 1 year ago

刚才newtab构建成功了,但是还有个问题,请教下大佬,因为newtab还想部署web版本,如何配置可以实现newtab相关资源 单独打包到一个web目录下

Jervis2049 commented 1 year ago

刚才newtab构建成功了,但是还有个问题,请教下大佬,因为newtab还想部署web版本,如何配置可以实现newtab相关资源 单独打包到一个web目录下

不支持这样的功能,所有都是打包在一个目录的。你把那个目录整个部署应该也没关系,只是有些多余文件,或者你可以写个脚本提取构建后的相关文件。

xtgcs commented 1 year ago

OK,感谢大佬,有没有打算支持shadowDOM

Jervis2049 commented 1 year ago

OK,感谢大佬,有没有打算支持shadowDOM

想支持,但近期还没时间研究。