Closed jacksteamdev closed 2 years ago
@evanb2 Thanks for reporting this! This was an oversight in the most recent rewrite. I think it's a nice feature, so I'm converting this to an issue.
Docs for v4 are WIP, there are some API differences. In the meantime, I'm writing an article with a more complex config example (typescript manifest, public folder, etc).
One key difference is that v4 won't copy assets from web_accessible_resources
. You can declare web accessible resources, but if you want them copied, you can put those resources in the public folder.
Try putting manifest images in the public folder for now, that should work in production. Once #224 lands it will work in development.
// manifest.json
{
"icons": {
"16": "assets/images/logo_16.png",
"32": "assets/images/logo_32.png",
"48": "assets/images/logo_48.png",
"128": "assets/images/logo_128.png"
},
}
- src/
- public/
|- assets/
|- images/
- logo_16.png
- logo_32.png
- logo_48.png
- logo_128.png
- manifest.json
- vite.config.js
I have same issue with icons also on top of that if i include script in web_accessible_resources
it does not get copied
web_accessible_resources: [
{
matches: ['<all_urls>'],
resources: ['src/lib.ts'],
},
],
- src/
- lib.ts
- manifest.json
- vite.config.ts
Also later how would i reference this resources using chrome.runtime.getURL('lib.js')
? Since the file name differs based on hash from build
Also later how would i reference this resources using chrome.runtime.getURL('lib.js') ? Since the file name differs based on hash from build
@heathsnee Good point. I can imagine this pattern being useful for content scripts that inject a script into the main page execution context. Is this what you are doing, or do you have another use case?
yes exactly what i am trying to do
web_accessible_resources
are coming soon@jacksteamdev the auto-copying for manifest assets doesn't seem to work for me. I'm on version 4.0.1-18
with the same file structure as OP.
Hello again @jacksteamdev, is the auto-copying feature not released yet? But will be in the next release, according to your reply here https://github.com/extend-chrome/rollup-plugin-chrome-extension/issues/270#issuecomment-1087890718? Thanks!
@essarn This is fixed! :rocket:
If you haven't already, please migrate to @crxjs/vite-plugin
so you can get the latest updates!
Migration instructions here: https://dev.to/jacksteamdev/rpce-is-moving-to-crxjsvite-plugin-2lmi
Discussed in https://github.com/extend-chrome/rollup-plugin-chrome-extension/discussions/225