electron-chrome-extension icon indicating copy to clipboard operation
electron-chrome-extension copied to clipboard

Local Extension Path?

Open IceHacks opened this issue 6 years ago • 7 comments

I was wondering if you can use this to load a local extension (like one not on the webstore). Right now I am trying but I get this error:

(node:13020) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'scanInstalledExtensions' of undefined
    at ECx.<anonymous> (C:\path\electron-chrome-extension\lib\browser\engine\api.js:30:36)
    at Generator.next (<anonymous>)
    at C:\path\node_modules\tslib\tslib.js:110:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\BakedPotato\Desktop\surviv-bot\my-app\node_modules\tslib\tslib.js:106:16)
    at ECx.load (C:\path\node_modules\electron-chrome-extension\lib\browser\engine\api.js:28:24)
    at App.createWindow (C:\path\src\index.js:12:6)
    at App.emit (events.js:199:15)
(node:13020) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13020) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit 
code.

IceHacks avatar Jul 26 '19 00:07 IceHacks

@IceHacks Do you have the solution? I'm stuck at the same error!

theharshin avatar Oct 08 '19 13:10 theharshin

@theharshin no I never found one.

IceHacks avatar Oct 09 '19 20:10 IceHacks

I'd like to see this feature, as well.

rangerscience avatar Jan 02 '20 10:01 rangerscience

Hi, okay, I'm still running into various odd issues and can't actually tell if this is working, but this is the code that I wrote to make it happen. I literally just stuck it into the right place in the node_modules/... file. Ideally at some point I learn TypeScript and whatever build process and submit it here - or, given the lack of attention by the authors, a fork ;)

lib/browser/engine/api.js:

    load(extensionId) {...}
    localLoad(name, version) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            if (this.loaded.has(name)) {
                return this.loaded.get(name);
            }
            const location = `./vendor/${name}/${version}`
            const extension = yield {
              id: name,
              location: location,
              version: version,
              updateUrl: ''
            }
            chrome_extension_1.addExtension(name, location);
            this.loaded.set(name, extension);
            console.log("extension", extension)
            return extension;
        });
    }

rangerscience avatar Jan 14 '20 05:01 rangerscience

nice ;)

IceHacks avatar Feb 13 '20 19:02 IceHacks

Found a fix without changing the library

Call ECx.setConfiguration(); before calling load or any other function that references the fetcher property.

mattrq avatar Jun 10 '20 20:06 mattrq

I also want to load local plug-ins

freekingg avatar Jan 18 '21 04:01 freekingg