Closed Rhilip closed 3 years ago
I think this issue can be closed, since the update of webextension-polyfill-ts
at https://github.com/Lusito/webextension-polyfill-ts/commit/f3b2a155cd6e6538394037295d2d145f1e23e5fb and new @types/webextension-polyfill
at https://github.com/DefinitelyTyped/DefinitelyTyped/pull/54471
Describe the bug
After switch to Typescript by
vue add typescript
, I choosewebextension-polyfill-ts
as devDependencies, and useimport { browser } from 'webextension-polyfill-ts'
in background script. However, Now any browser function not work and this object IS undefined.The background.ts may like this:
I worked around and find
https://github.com/adambullmer/vue-cli-plugin-browser-extension#browser-polyfills
notes. After I follow those steps by editvue.config.js
, the browser object from webextension-polyfill-ts work again.Is there any idea to solve this bug? Since it is useful to develop in Typescript environment.
To Reproduce
webextension-polyfill-ts
as devDependenciesWhen use browser.runtime.sendMessage , The error shows.
I have to remove the webpack chain 'provide-webextension-polyfill' as Describe to make it work agian.
Expected behavior
Maybe I don't need to remove the webpack chain 'provide-webextension-polyfill', but the 'webextension-polyfill-ts' worked fined.
Screenshots If applicable, add screenshots to help explain your problem.
Reproducible Example
None at this moment, I'm sorry.
Additional context
package.json
vue.config.js