For example, the this service imports minimatch to use it in the real implementation, but minimatch is included in the final bundle in all entrypoints, not just the background.
Unfortunately, I can't think of a way to accomplish tree shaking without putting the real service and proxy service in a separate file. The more services you have, the more annoying it would be... Just lots of extra files in a project.
Maybe an alternative package, like @webext-core/background-api could be used to group all services under a single object.
For example, the this service imports
minimatch
to use it in the real implementation, but minimatch is included in the final bundle in all entrypoints, not just the background.Unfortunately, I can't think of a way to accomplish tree shaking without putting the real service and proxy service in a separate file. The more services you have, the more annoying it would be... Just lots of extra files in a project.
Maybe an alternative package, like
@webext-core/background-api
could be used to group all services under a single object.