webpack-ext-reloader icon indicating copy to clipboard operation
webpack-ext-reloader copied to clipboard

Current usage of webextension-polyfill pollutes global scope

Open someengineer-nordsec opened this issue 3 years ago • 1 comments

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

someengineer-nordsec avatar Mar 29 '22 15:03 someengineer-nordsec

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.

rushilsrivastava avatar Mar 29 '22 18:03 rushilsrivastava

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

sherifmayika avatar Nov 28 '22 16:11 sherifmayika

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.

vialoh avatar Sep 28 '23 17:09 vialoh