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
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server