yuuki-yuuna
yuuki-yuuna
PD🧩 Plasmo Developers
Created by yuuki-yuuna on 5/31/2023 in #🔰newbie
How Insert CSUI when Extension Action Icon is clicked
It doesn't work. like this:
import Menu from 'url:~/menu'

chrome.action.onClicked.addListener((tab) => {
console.log('action click', tab.id)
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: [Menu] // can not load
})
})
import Menu from 'url:~/menu'

chrome.action.onClicked.addListener((tab) => {
console.log('action click', tab.id)
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: [Menu] // can not load
})
})
or this:
chrome.action.onClicked.addListener((tab) => {
console.log('action click', tab.id)
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: ['url:~/menu/index.tsx'] // can not load
})
})
chrome.action.onClicked.addListener((tab) => {
console.log('action click', tab.id)
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: ['url:~/menu/index.tsx'] // can not load
})
})
12 replies
PD🧩 Plasmo Developers
Created by yuuki-yuuna on 5/31/2023 in #🔰newbie
How Insert CSUI when Extension Action Icon is clicked
Thank you for your reply, but I am unable to load files in relative paths when using this API. Just like this.
// /src/background/index.ts
chrome.action.onClicked.addListener((tab) => {
console.log('action click', tab.id)
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: ['../menu/index.tsx'] // I have a tsx file at /src/menu/index.tsx
})
})
// /src/background/index.ts
chrome.action.onClicked.addListener((tab) => {
console.log('action click', tab.id)
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: ['../menu/index.tsx'] // I have a tsx file at /src/menu/index.tsx
})
})
12 replies