Open jhildenbiddle opened 1 year ago
Thanks for the detailed request!
optimizeWebAccessibleResources
option they should still end up combined into a single entry, though.All sounds reasonable to me, @samrum.
One clarification worth making is that the files I'd like to include outside of the web extension root (the "external" files) are static files. Specifically, these files are loaded via dynamic import
so there are no static imports referencing files outside of the extension root for Vite to trip on while bundling. The goal is to just make the files available to the extension like other web_accessible_resources
files (i.e., watch the files, copy (build) or update (dev) when a change is detected, and modify the manifest accordingly).
I realize this doesn't cover every possible scenario that involves files outside of the extension root, but I thought it was worth clarifying in case it simplifies to problem.
First, thank you for the excellent project. I was looking an HMR solution for extension development, stumbled on this one, and have been very pleased with the results. Much appreciated.
Summary
Ideally, the
additionalInputs
option would:additionalInputs
/dist
, flatten directories, rename files, etc.Use Case
I have a monorepo containing an extension generated by this project stored in an
/extension
directory. The extension requires files accessed via the parent directory. For example, I'd like to include files from/files
directory in the directory structure below:I hoped I could use the
additionalInputs
option to watch/copy these files to/dist
, add them to theweb_accessible_resources
section inmanifest.json
automatically, and have that work for both a build and development using HMR:Unfortunately, using paths outside of the extension root results in the following error:
I've tried several other approaches to using files outside of the extension root, but they all have issues:
web_accessible_resources
inmanifest.json
.webExtension
plugin hook (copy happens afterwebExtension
)/extension/src
create unwanted duplicates outside of/dist
directorymanifest.json
updates work properly when Ibuild
but not during development with HMR.I can cobble a solution together, but it will be a much less elegant since the
additionalInputs
option does exactly what I need except it currently does not work with files outside of the extension root.Proposed Enhancements
Given the same directory structure shown above, I'd like to use a glob pattern to reference all of the files in the
/files
directory:This would expect this to produce the following:
If options similar to the ones found in rollup-plugin-copy or vite-plugin-static-copy were added, the
additionalInputs
configuration could look something like this:Thanks in advance for your consideration. I'm happy discuss in more detail and contribute to the effort if you believe this would be worth doing.