plasmo
plasmo copied to clipboard
[BUG] Icon Assets not found after 0.84 update
What happened?
After updating from 83 to 84, the build process errors out due to:
🔴 ERROR | Failed to resolve './gen-assets/icon16.plasmo.png' from './.plasmo/chrome-mv3.plasmo.manifest.json'
🔴 ERROR | Cannot load file './gen-assets/icon16.plasmo.png' in './.plasmo'.
🔴 ERROR | Cannot load file './gen-assets/icon32.plasmo.png' in './.plasmo'.
🟡 22 | Did you mean '__../src/assets/icon.png__'?
Even after deleting .plasmo
, the same error occurs.
Looking at .plasmo
, there is no gen-assets
folder, which seems like the folder is not generated before it is tried to access.
Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
Chrome, Firefox
Relevant log output
🔴 ERROR | Failed to resolve './gen-assets/icon16.plasmo.png' from './.plasmo/chrome-mv3.plasmo.manifest.json'
🔴 ERROR | Cannot load file './gen-assets/icon16.plasmo.png' in './.plasmo'.
🔴 ERROR | Cannot load file './gen-assets/icon32.plasmo.png' in './.plasmo'.
🟡 22 | Did you mean '__../src/assets/icon.png__'?
(OPTIONAL) Contribution
- [ ] I would like to fix this BUG via a PR
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I checked the current issues for duplicate problems.
Even after downgrading to 0.83 the issue persists. I was able to temporarily skip this build error by manually adding .pngs into .plasmo/gen-assets
with the icon files specified in /.plasmo/chrome-mv3.plasmo.manifest.json
. However, still waiting on an official fix/explanation.
Hmm that's very weird... All the E2E build test passed meaning they were able to resolve the icons: https://github.com/PlasmoHQ/plasmo/actions/runs/6822430999/job/18554456871
Can you post the full output of plasmo dev --verbose
?
Thanks for the quick feedback. I changed my source directory from root to /src a while ago (2 weeks), but hadn't had any issue with it yet. Also, I use type: module.
🔴 ERROR | Failed to resolve './gen-assets/icon16.plasmo.png' from './.plasmo/chrome-mv3.plasmo.manifest.json' 🟡 22 |
{
"icons": {
"16": "./gen-assets/icon16.plasmo.png",
"32": "./gen-assets/icon32.plasmo.png",
"48": "./gen-assets/icon48.plasmo.png",
"64": "./gen-assets/icon64.plasmo.png",
"128": "./gen-assets/icon128.plasmo.png"
},
"manifest_version": 3,
"action": {
"default_icon": {
"16": "./gen-assets/icon16.plasmo.png",
"32": "./gen-assets/icon32.plasmo.png",
"48": "./gen-assets/icon48.plasmo.png",
"64": "./gen-assets/icon64.plasmo.png",
"128": "./gen-assets/icon128.plasmo.png"
},
"default_popup": "./popup.html"
},
"background": {
"service_worker": "./static/background/index.ts"
},
"chrome_url_overrides": {
"newtab": "./newtab.html"
},
"permissions": [
"scripting",
"tabs"
],
"content_scripts": [
{
"matches": [
"https://www.plasmo.com/*"
],
"js": [
"static/contents/plasmo-inline.ts"
]
}
],
"content_security_policy": {
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'"
},
"host_permissions": [
"https://*/*"
],
"web_accessible_resources": [
{
"resources": [
"assets/local-models/**/*"
],
"extension_ids": [
"*"
],
"matches": [
"https://*/*",
"*://*/*",
"<all_urls>"
]
},
{
"resources": [
"assets/example"
],
"matches": [
"https://*/*",
"*://*/*",
"<all_urls>"
]
}
]
}
🟡 23 | /Users/.../.plasmo/chrome-mv3.plasmo.manifest.json:12:13 🔴 ERROR | Cannot load file './gen-assets/icon16.plasmo.png' in './.plasmo'. 🟡 24 | Did you mean '../src/assets/icon.png'
I am also getting WARN | No icon found in assets directory
on plasmo start-up.
🟣 Plasmo v0.84.0
🔴 The Browser Extension Framework
🔵 INFO | Starting the extension development server...
🟠WARN | No icon found in assets directory
Yet there is an icon.png in /src/assets
I encountered the same error when getting started with pnpm create plasmo
.
- pnpm create plasmo: [email protected] in packag.json and node_modules
- move all source code files into the src directory including assets folder
- update compilerOptions.paths in tsconfig.json
- pnpm run dev
@MentalGear It worked for me when I move the assets directory out of the src directory.
https://github.com/PlasmoHQ/plasmo/blob/00fb828df6298beb480783c941b4c970811e46c3/cli/plasmo/src/features/extension-devtools/common-path.ts#L47
Seems to be a definite problem from switching to /src later on. I am still experiencing the error and occasionally have to manually add the gen-assets folder into the .plasmo folder again or it won't compile.
Thx for the input. Do you mean rewriting the assetsDirectory: resolve(projectDirectory, "assets"),
line and manually moving the folder out of assets
?
On 28 Dec 2023, at 09:43, fukang wang @.***> wrote:
I encountered the same error when getting started with pnpm create plasmo.
pnpm create plasmo: @.*** in packag.json and node_modules move all source code files into the src directory including assets folder update compilerOptions.paths in tsconfig.json pnpm run dev — Reply to this email directly, view it on GitHub https://github.com/PlasmoHQ/plasmo/issues/825#issuecomment-1870946472, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVUVG6MJSNIIWHHGXAICHDYLUWL3AVCNFSM6AAAAAA7UMM7QOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQHE2DMNBXGI. You are receiving this because you authored the thread.
Seems to be a definite problem from switching to /src later on. I am still experiencing the error and occasionally have to manually add the gen-assets folder into the .plasmo folder again or it won't compile. Thx for the input. Do you mean rewriting the
assetsDirectory: resolve(projectDirectory, "assets"),
line and manually moving the folder out ofassets
? … On 28 Dec 2023, at 09:43, fukang wang @.> wrote: I encountered the same error when getting started with pnpm create plasmo. pnpm create plasmo: @. in packag.json and node_modules move all source code files into the src directory including assets folder update compilerOptions.paths in tsconfig.json pnpm run dev — Reply to this email directly, view it on GitHub <#825 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVUVG6MJSNIIWHHGXAICHDYLUWL3AVCNFSM6AAAAAA7UMM7QOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQHE2DMNBXGI. You are receiving this because you authored the thread.
Try to move assets
from src
to projectDirectory
directory
There's a weird solution, I add .plasmo
directory to git to avoid the unexpected configuration files lost.
Try to move
assets
fromsrc
toprojectDirectory
directory
That worked for me!
I'm facing the same issue.
I have both src and assets as sibling in the root of the repo. However, when building, plasmo (v85.2) tries to get the icon inside the src folder:
🔴 ERROR | ENOENT: no such file or directory, stat 'C:\\path\my-extension\\src\\assets\\icon.png'
If I move the asset folder inside the src folder, I fall into the issue described above.
What did I miss?