[BUG] Possible Bug: Incorrect CSS Hash in `web_accessible_resources` When Building for Edge MV3
What happened?
Today, I attempted to publish a Chrome Web Store extension to Microsoft Edge and encountered a potential bug.
I built the extension using:
plasmo build --zip --target=edge-mv3
After uploading the ZIP file to Microsoft Partner Center, the submission failed with the following error:
Your package failed certification. Make corrections and certify again.
The following checks failed:
Package acceptance validation error: Manifest file reference'toc.8ea80c20.css'does not exist in the zip archive. (Note: File locations are case-sensitive)
Upon inspecting the generated manifest.json, I found that the web_accessible_resources field referenced a non-existent CSS file:
{
"icons": {
"16": "icon16.plasmo.60403714.png",
"32": "icon32.plasmo.8e850565.png",
"48": "icon48.plasmo.37989d43.png",
"64": "icon64.plasmo.a993afcb.png",
"128": "icon128.plasmo.9b3294c4.png"
},
"manifest_version": 3,
"action": {
"default_icon": {
"16": "icon16.plasmo.60403714.png",
"32": "icon32.plasmo.8e850565.png",
"48": "icon48.plasmo.37989d43.png",
"64": "icon64.plasmo.a993afcb.png",
"128": "icon128.plasmo.9b3294c4.png"
},
"default_popup": "popup.html"
},
"version": "1.0.1",
"author": "Frankie <[email protected]>",
"name": "Github Issue TOC",
"description": "It adds a table of contents to Github's issue pages for quick browsing and content navigation.",
"background": { "service_worker": "static/background/index.js" },
"permissions": ["webNavigation"],
"content_scripts": [
{
"matches": ["https://github.com/*"],
"js": ["toc.060ec9d8.js"],
"css": ["toc.fa35df8d.css"],
"run_at": "document_end"
}
],
"host_permissions": ["https://github.com/*"],
"web_accessible_resources": [
{ "matches": ["https://github.com/*"], "resources": ["toc.8ea80c20.css"] }
]
}
However, the actual file in the ZIP archive was toc.fa35df8d.css.
edge-mv3-prod
โโโ icon128.plasmo.9b3294c4.png
โโโ icon16.plasmo.60403714.png
โโโ icon32.plasmo.8e850565.png
โโโ icon48.plasmo.37989d43.png
โโโ icon64.plasmo.a993afcb.png
โโโ manifest.json
โโโ popup.c487ea80.css
โโโ popup.d27f9a89.js
โโโ popup.html
โโโ static
โ โโโ background
โ โโโ index.js
โโโ toc.060ec9d8.js
โโโ toc.fa35df8d.css
The hash in the filename does not match the reference in manifest.json.
This issue also occurs when building for chrome-mv3, but Chrome Web Store does not flag it as an error during upload.
I later discovered that this issue occurs in both plasmo dev and plasmo build, regardless of the target platform.
My extension repository is: github-issue-toc. You can clone it and run:
$ git clone https://github.com/tofrankie/github-issue-toc.git
$ cd github-issue-toc
$ pnpm install
# or pnpm dev
$ pnpm build:edge
Then inspect the generated build/edge-mv3-prod/manifest.json.
Compare the content_scripts and web_accessible_resources fieldsโ
the content_scripts field references a valid toc.<hash>.css, but the corresponding entry in web_accessible_resources points to a non-existent file.
Environment:
- Plasmo: v0.90.3
- React: v18.2.0
- Node.js: v20.10.0
- OS: macOS 15.3.1
Please take a look, thanks!
Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
Chrome, Microsoft Edge
Relevant log output
Your package failed certification. Make corrections and certify again.
The following checks failed:
Package acceptance validation error: Manifest file reference 'toc.8ea80c20.css' does not exist in the zip archive. (Note: File locations are case-sensitive)
(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.
Facing similar issue.
The following checks failed: Package acceptance validation error: Manifest file reference 'XXX-VariableFont_wght.a1a0c355.ttf' does not exist in the zip archive. (Note: File locations are case-sensitive) Package acceptance validation error: Manifest file reference 'xxx-browser-extension.4c8bcc91.css' does not exist in the zip archive. (Note: File locations are case-sensitive)
I also encountered this problem, please fix it. Thanks~
same error with example:with-css-modules
At last, some success
I unpacked the zip, removed "web_accessible_resources", re-zipped it, and uploaded it directly to the MS Edge store.
MS just approved the extension, and it's live.
Code that needs to be removed
"web_accessible_resources": [
{ "matches": ["anything"], "resources": ["anything"] }
]
Please test end to end after removing before publishing.
Use these at your own risk*
At last, some success
I unpacked the zip, removed "web_accessible_resources", re-zipped it, and uploaded it directly to the MS Edge store.
MS just approved the extension, and it's live.
Code that needs to be removed
"web_accessible_resources": [ { "matches": ["anything"], "resources": ["anything"] } ]Please test end to end after removing before publishing.
Use these at your own risk*
Thank you, was also required for us.
I my case, it was adding a css resource which does not exist:
"web_accessible_resources": [
{ "matches": ["<all_urls>"], "resources": ["content.6e038a4b.css"] }
]
which should have been
"web_accessible_resources": [
{ "matches": ["<all_urls>"], "resources": [] }
]
Removing it manually and packaging it worked. But this means, I have do it manually every time I want to publish a new version. Can't automate it via github action.