sindresorhus/electron-context-menu

Not Working on Production

EhsanFox opened this issue ยท 10 comments

hey, I build my app with electron-builder and the context menu is not working in the production, but it works fine in developments.

when i click, it won't open anything.......

We can't help if you don't provide more info :/

And also, you shouldn't ask for help here. I come from the electron.js discord server, there we can help you! This is only to track bugs and other stuff.

well, this kinda looks like a bug, it works before building/packaging the app, but not afterward.

for more information, I just did what it said on example, it works fine in the dev process

for more information, I just did what it said on example, it works fine in the dev process

We don't know which app isn't working or how we should repro this issue :/. Maybe create a repro gist or link your repo?

well, the app is private, but the context menu (literally the example code) in the readme is not working on the production......
i opened a help channel in Electron discord server too (channel number 9)

here is the code:

const ctxMenu = require("electron-context-menu");
ctxMenu({
        window: mainTab,
        labels: {
            copy: "๐Ÿ“„ | Copy",
            paste: "๐Ÿ“‹ | Paste",
            cut: "โœ‚ | Cut"
        },

        /* Context Menu Items */
        menu: (actions, params, win, dicSuggestion) => [
            /* Custom Buttons */
            {
                label: 'WinTube v'+version,
                icon: path.resolve(__dirname, "..", "..", "src", "icons", "main-min.png"),
                enabled: false,
            },
            {
                label: 'Discord Server',
                icon: path.resolve(__dirname, "..", "..", "src", "icons", "discord.png"),
                click: () => open('https://discord.gg/GBDkr9T')
            },
            actions.separator(),
            /* System Buttons */
            actions.copy(),
            actions.cut(),
            actions.paste(),
            actions.separator(),
            /* Public Buttons */
            {
                label: "Exit",
                icon: path.resolve(__dirname, "..", "..", "src", "icons", "shutdown.png"),
                click: () => app.quit()
            },
            
            /* Dev Buttons */
            {
                label: 'Developer Tools',
                icon: path.resolve(__dirname, "..", "..", "src", "icons", "dev-tools.png"),
                click: () => mainTab.webContents.openDevTools(),
                visible: isDev
            },
        ]
    });
    
    it's on 'ready' event btw.

Where is this code? Main thread? Renderer thread?

app ready event is obviously on the main thread

nop33 commented

Are you sure you didn't install it as a dev dependency?