PD
🧩 Plasmo DevelopersSteven
Build variable to indicate "background" or "content" script?
Right now the only thing I can do to determine if a shared function is running in content or background is by checking
"serviceWorker" in globalThis
which unfortunately is a runtime check. Is there a variable (documented or not) that exists in env that would make it so code can be tree shaken? e.g. if (process.env.PLASMO_BUILD_TARGET !== "background") { ... }
would allow the bundler to drop this branch if it's part of the background bundle.
This is largely so I can share utility code between content and background where it performs all of its work in background (content scripts using messaging to background). Right now because I have to use a runtime check, a bunch of never used in content scripts code is included in the content scripts bundles.2.1KMembers
View on DiscordWant results from more Discord servers?
More Postshow can I pcik suffix for files from lib, like main.web.js & main.native.js?I am using a lib which exports both versions of files. my issue is it keeps resolving to the native useStorage makes extension window tiny.every time i use the useStorage hook my windows resizes
it's driving me crazy
const [datas] = useStoI am trying to console.log a string but I am not quite sure where it is. Where do I see console.logWhere do I see console.log messages written in the popup.tsx file?Unable to install storage API in my projectstarted a new project recently and the API is not getting installed locally, whenever I try to "pnpm