#Methods like win.show() cannot be executed after packaging.

26 messages · Page 1 of 1 (latest)

stark tangle
#

My friends, I need help. I used electron in vue-cil with the Plugin named "Vue CLI Plugin Electron Builder". With everything ready in background.js, I'm using electron:serve, and everything is fine. But after I packaged it with electron:build, I opened my program and some of the methods didn't get executed, here's why. win.show()and win.setMenu(null) and so on. Who can tell me why?

limber sphinx
#

show screenshot with loaded window

stark tangle
#

Packing is all right.

limber sphinx
#

show loaded window

stark tangle
#

But this method is invalid win.setMenu(null)

limber sphinx
#

why do you think its invalid?

#

you load local file

#

or from dev server?

stark tangle
#

If it works, the menu bar in the red box will not appear

limber sphinx
#

from where you load this page?

stark tangle
#

electron:serve

limber sphinx
#

=/

#

this is packaged app or development?

stark tangle
#

development

#

this is packaged

limber sphinx
#

what happens if you add win.removeMenu() to else block?

stark tangle
#

I'm trying.

#

god

#

.....

#

Actually works

#

I packed it. It worked

#

what did i begin to realize when you asked me to try something in "else"....So the above for development testing? ohhhhh...my god..

limber sphinx
#

probably

#

temporary env variables doesnt exists in packaged app

stark tangle
#

ok thanks bro, I really, I didn't realize that. I'm a Chinese and I didn't pay any attention to if (process.env.WEBPACK_DEV_SERVER_URL)... If I were more sensitive to English, I might find that...