Giter Club home page Giter Club logo

Comments (7)

mia-zhao avatar mia-zhao commented on September 14, 2024 5

I don't quite understand the error behind. But I played around a bit, manually importing import browser from 'webextension-polyfill' in Popup.vue or updating the auto import config 'webextension-polyfill': [ ['*', 'browser'], ], to 'webextension-polyfill': [ ['default', 'browser'], ], seems to fix the undefined error

from vitesse-webext.

tmkx avatar tmkx commented on September 14, 2024 2

updating the auto import config 'webextension-polyfill': [ ['*', 'browser'], ], to 'webextension-polyfill': [ ['default', 'browser'], ], works in dev, but breaks in production.

it seems like a bug in the unplugin-auto-import (not sure), PRs welcome :)

from vitesse-webext.

Rebuilding127 avatar Rebuilding127 commented on September 14, 2024 1

I have another problem. After updating "webextension-polyfill": [["*", "browser"]], to "webextension-polyfill": [["default", "browser"]],, it can run without error, but the type prompt for browser is no longer available.

I restored "webextension-polyfill": [["default", "browser"]], to "webextension-polyfill": [["*", "browser"]],, then add import browser from "webextension-polyfill" in Popup.vue, it works.
But I'm not sure if this is correct, hope there is a better solution.

from vitesse-webext.

mia-zhao avatar mia-zhao commented on September 14, 2024

hi @tmkx thanks for following up. It does look like a limitation of unplugin-auto-import.

Based on the generated code from unplugin-auto-import, when 'webextension-polyfill': [ ['*', 'browser'] ] is configured, the Browser type is generated correctly (however, the browser object imported is not - the actual browser alias needed is in fact browser.default, and thus the reason browser.runtime is undefined). Likewise, if 'webextension-polyfill': [ ['default', 'browser'] ] is used, the imported object is correct (while Browser type is not).

from vitesse-webext.

zreren avatar zreren commented on September 14, 2024

updating the auto import config 'webextension-polyfill': [ ['*', 'browser'], ], to 'webextension-polyfill': [ ['default', 'browser'], ], works in dev, but breaks in production.

it seems like a bug in the unplugin-auto-import (not sure), PRs welcome :)

That works for me

from vitesse-webext.

Rebuilding127 avatar Rebuilding127 commented on September 14, 2024

updating the auto import config 'webextension-polyfill': [ ['*', 'browser'], ], to 'webextension-polyfill': [ ['default', 'browser'], ], works in dev, but breaks in production.
it seems like a bug in the unplugin-auto-import (not sure), PRs welcome :)

That works for me

me too

from vitesse-webext.

Rebuilding127 avatar Rebuilding127 commented on September 14, 2024

I have another problem.
After updating "webextension-polyfill": [["*", "browser"]], to "webextension-polyfill": [["default", "browser"]],, it can run without error, but the type prompt for browser is no longer available.

from vitesse-webext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.