在开发模式下运行电子

时间:2021-04-11 03:39:44

标签: electron electron-builder

我需要在本地运行时以开发者模式运行电子应用程序,在构建应用程序时以生产模式运行电子应用程序,并且我需要在应用程序期间读取此环境变量。

我使用 22.8.0 版本的 electron-builder 来构建应用程序,而 Electron 的版本是 10.0.0。

谢谢:)

1 个答案:

答案 0 :(得分:0)

如果我理解您的问题,以下是我在开发时用来运行 ApplicationContext context= new ClassPathXmlApplicationContext("config.xml"); Student student1=(Student) context.getBean("s1"); System.out.println(student1.getStudentId()); 的内容。我认为现在还有其他更好的方法可以做到这一点,但几年来它对我来说效果很好。

try { // knex query here } catch(error) { if(error instanceof DatabaseError) { // handle pg error by checking error.code or something else // then send an custom error message to the client } // handle another error here which is not caused by the postgres server } 脚本中定义一个变量:

electron-reload

然后在start中阅读:

  "scripts": {
    "start": "APP_DEV=true electron .",
  },
相关问题