Current usage of webextension-polyfill pollutes global scope
Describe the bug
In our project we are already using webextension-polyfill (via UMD).
This project uses https://github.com/SimplifyJobs/webpack-ext-reloader/blob/master/src/middleware/middleware-source-builder.ts#L16 which will pollute global scope
Error Stacks
put error stacks here
To Reproduce
Try to use webextension-polyfill (as UMD) and webpack-ext-reloader at the same time
Config
add your webpack config here
Example
Expected behavior
Usage of webextension-polyfill within this project should not pollute global scope. It should be imported as a module.
Environment:
- OS:
- Browser Version:
- webpack Version:
- webpack-ext-reloader Version:
I'm going to open a PR
- [ ] yes
- [ ] no
- [x] maybe
Additional information
Can you provide a minimal example of your case? The reason this is injected is so that it works for all webext supported-browsers without having to use the polyfill (i.e. if you are only targeting one browser anyways). We use it internally with webextension-polyfill and haven't had any issues.
webextension-polyfill is useless in MV3 kindly remove it. https://stackoverflow.com/questions/68488195/browser-extension-manifest-v3-with-webextension-polyfill-does-not-allow-browser
I looked into this and without a reproducible example, I'm not sure of the best way to fix it. I'm closing this for now but if you can provide an example for me to go by (or ideally create a PR with the fix yourself), I will reopen.