Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from webextension-polyfill-ts to @types/webextension-polyfill #1266

Closed
twschiller opened this issue Sep 11, 2021 · 3 comments · Fixed by #1763
Closed

Switch from webextension-polyfill-ts to @types/webextension-polyfill #1266

twschiller opened this issue Sep 11, 2021 · 3 comments · Fixed by #1763
Labels
dependencies Pull requests that update a dependency file developer experience low priority

Comments

@twschiller
Copy link
Contributor

[email protected]: This project has moved to @types/webextension-polyfill

@twschiller twschiller added dependencies Pull requests that update a dependency file low priority labels Sep 11, 2021
@fregante
Copy link
Contributor

fregante commented Sep 12, 2021

My bad 😃 fregante/Awesome-WebExtensions#61 (comment)

By the way I suggest making the browser variable global while we're at it, it also simplifies debugging because it lets us run promisified commands in the dev tools.

@twschiller
Copy link
Contributor Author

Haha. How would you make browser global, via webpack provides? I suspect depending on how you make it global it might break something (e.g., tests, or maybe something else) because the underlying Mozilla library does a context check

@fregante
Copy link
Contributor

fregante commented Sep 20, 2021

How would you make browser global

By loading the polyfill on its own like you would without a build:

https://github.com/sindresorhus/refined-github/blob/99e81baaac8c787d1a59b74194c9437e9c29ffdf/distribution/manifest.json#L38

and have webpack copy the raw file over:

https://github.com/sindresorhus/refined-github/blob/99e81baaac8c787d1a59b74194c9437e9c29ffdf/webpack.config.ts#L54-L58

We'd add the import exactly like we're doing with vendor.js

via webpack provides

Unfortunately not fully supported: mozilla/webextension-polyfill#156

But at the end of that thread there's an alternative solution, I just never used it though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file developer experience low priority
2 participants