Kurolox
Kurolox
PD🧩 Plasmo Developers
Created by Kurolox on 10/30/2023 in #👟framework
Extension fails to run due to Parcel - The Expression evaluated to a falsy value
About four days ago, I ran into an issue where the extension would fail to run with the following error:
🟡 3 | @plasmohq/parcel-runtime Injecting << background-service-runtime >> for static/background/index.js c338908e704c91f1 /home/user/project/browser-extension/.plasmo/static/background/index.ts
🔴 ERROR | The expression evaluated to a falsy value:

(0, \_assert().default)(bundleGraph instanceof \_BundleGraph.default)
🟡 3 | @plasmohq/parcel-runtime Injecting << background-service-runtime >> for static/background/index.js c338908e704c91f1 /home/user/project/browser-extension/.plasmo/static/background/index.ts
🔴 ERROR | The expression evaluated to a falsy value:

(0, \_assert().default)(bundleGraph instanceof \_BundleGraph.default)
This is weird because I don't think I've changed anything in the project. I maybe ran an npm install recently, and I believe this might be dependency related, but I cannot find where the issue comes from or how to work around it. Here are the contents of /home/user/project/browser-extension/.plasmo/static/background/index.ts, the file where Parcel breaks:
import "../../../src/background"
import "../../../src/background"
And here's the background file that it's being imported, which is pretty much just an event listener so I'm not sure what the problem is.
import { ScriptMessages } from "~enums/script-messages"

export {}

chrome.action.onClicked.addListener(() => {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const activeTab = tabs[0]
chrome.tabs.sendMessage(activeTab.id, { message: ScriptMessages.TOGGLE_EXTENSION })
})
})

console.log("Background script loaded")
import { ScriptMessages } from "~enums/script-messages"

export {}

chrome.action.onClicked.addListener(() => {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const activeTab = tabs[0]
chrome.tabs.sendMessage(activeTab.id, { message: ScriptMessages.TOGGLE_EXTENSION })
})
})

console.log("Background script loaded")
Any idea how to troubleshoot this issue? I've gone through the issue tracker and I couldn't find anything helpful. I've tried with the --no-hoist flag without any luck, and this happens both when running dev and build
2 replies
PD🧩 Plasmo Developers
Created by Kurolox on 10/4/2023 in #👟framework
Plasmo adds <all_urls> content script automatically, triggering host permissions
Title. I have a contents directory with some content scripts, however the generated manifest.json also adds an additional content script:
{ "matches": ["<all_urls>"], "js": ["configs.9ddedc67.js"], "css": [] },
{ "matches": ["<all_urls>"], "js": ["configs.9ddedc67.js"], "css": [] },
This is triggering some warnings in the Chrome Web Store, asking to use the activeTabs permission or to add the specific domains to the rule. Is there any way to force plasmo not to use this generic match? This didn't happen in older versions of Plasmo, but I'm unable to pinpoint exactly when this started to happen
2 replies