【问题标题】:Building my electron app and running it at the same time?构建我的电子应用程序并同时运行它?
【发布时间】:2021-07-08 07:45:23
【问题描述】:

我第一次环顾四周时,无法在此处找到针对我的具体案例的答案。我正在使用 react、tailwind、typescript、electron 和 parcel。

我是这个堆栈的新手,所以我花了很长时间才让堆栈顺利运行。我的问题目前是每次我更改代码中的某些内容时我的 package.json 是如何设置的,我必须构建它然后运行它以反映更改。我可以更改我的 package.json 以一起完成这一切,还是有某种我可以使用的插件或我可以编写的脚本来自动化它?

我的 package.json:

    {
  "name": "electron-typescript-starter",
  "version": "1.0.0",
  "main": "index.js",
  "author": "Huy",
  "license": "BSD-2-Clause",
  "dependencies": {
    "@types/react": "^16.9.2",
    "@types/react-dom": "^16.8.5",
    "electron": "^6.0.2",
    "parcel-bundler": "^1.12.3",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "tailwindcss": "^1.1.2"
  },
  "scripts": {
    "dev": "parcel ./index.html",
    "app": "electron electron.js",
    "dist": "parcel build ./index.html",
    "watch": "parcel watch ./index.html --public-url ./ --target=electron-renderer"
  },
  "devDependencies": {
    "sass": "^1.22.10",
    "typescript": "^3.5.3"
  }
}

【问题讨论】:

    标签: typescript electron tailwind-css parceljs


    【解决方案1】:

    不确定这是否是最佳实践,但我能够完成这项工作的方法是使用一种称为并发的方法,它允许您在一个脚本中执行多个参数。

    "start": "concurrently \"parcel watch ./index.html --public-url ./ --target=electron-renderer\" \"electron electron.js\""
    

    【讨论】:

      猜你喜欢
      • 2018-07-15
      • 2018-04-02
      • 1970-01-01
      • 1970-01-01
      • 2020-11-02
      • 2017-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多