Comments (6)
@rhinonan 刚发布了0.0.7-beta.0 , 支持这个功能了,安装这个版本试下。
from vite-plugin-crx-mv3.
可以写个demo吗,然后上传到你的GITHUB仓库,我看看你现在的写法。
from vite-plugin-crx-mv3.
demo 在公司,有信息安全整不出来,我贴下主要代码。 我用的是你的example 里面的 vue 示例
如果不能理解,我再重新写一个DEMO
// content.ts 主要代码
window.onload = async () => {
const el = document.querySelector('body');
const sc = document.createElement('script');
// 我需要获取页面中的js变量,所有只能插入这个js,并且这个资源需要在manifest -> web_accessible_resources 中声明
// 这个js我希望ts编写,所以希望vite能够编译
//
const injected = chrome.runtime.getURL('content_script/injected.js');
sc.src = injected;
if (el) {
el.appendChild(sc);
}
}
/* manifest.json */
{
......,
"web_accessible_resources": [
{
"resources": ["content_script/injected.js"],
"matches": [
"*://*/*",
"<all_urls>"
]
}
]
}
from vite-plugin-crx-mv3.
demo 在公司,有信息安全整不出来,我贴下主要代码。 我用的是你的example 里面的 vue 示例
如果不能理解,我再重新写一个DEMO
// content.ts 主要代码 window.onload = async () => { const el = document.querySelector('body'); const sc = document.createElement('script'); // 我需要获取页面中的js变量,所有只能插入这个js,并且这个资源需要在manifest -> web_accessible_resources 中声明 // 这个js我希望ts编写,所以希望vite能够编译 // const injected = chrome.runtime.getURL('content_script/injected.js'); sc.src = injected; if (el) { el.appendChild(sc); } }/* manifest.json */ { ......, "web_accessible_resources": [ { "resources": ["content_script/injected.js"], "matches": [ "*://*/*", "<all_urls>" ] } ] }
好的,明白你意思了,之前确实没考虑到这种情况。
from vite-plugin-crx-mv3.
大佬牛逼,我现在就试一试
from vite-plugin-crx-mv3.
@Jervis2049 已经验证,能够正常编译。
from vite-plugin-crx-mv3.
Related Issues (20)
- manifest->background 设置type:"module",打包后自动被去除 HOT 2
- manfest.json的 action设置为{} 后 Cannot use 'in' operator to search for 'width' in undefined HOT 2
- production: build never ends HOT 1
- 关于content样式隔离 HOT 10
- window.localtion.reload是否可以添加配置控制 HOT 5
- unsafe-eval HOT 1
- newtab.html 不能用vue构建 HOT 8
- 注入js文件 HOT 11
- 插件无法运行 HOT 4
- content_scripts "world": "MAIN" 报错 HOT 7
- request support i18n HOT 1
- import 无法直接引入包 HOT 7
- svg 无法渲染 HOT 3
- Manifest.web_accessible_resources 似乎没有处理 content script 所动态引入的 injected.js HOT 5
- Failed to load config (The requested module 'acorn' does not provide an export named 'default') HOT 1
- 打包时生成manifest.json中的default_popup的地址也许可以优化 HOT 1
- Support new versions of vite(typescript) with acorn library exporting HOT 1
- Sourcemap is likely to be incorrect: a plugin (vite-plugin-crx-mv3) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help HOT 6
- content-scripts的热部署貌似会有问题,需要重新到插件中心,刷新才能更新最新内容
- 目前还不支持sidePanel吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-crx-mv3.