无法打包/构建Electron Forge应用进行生产

时间:2019-04-08 19:02:29

标签: reactjs electron electron-forge

我正在通过EF React模板使用Electron Forge,React等的当前版本。当我运行用packagemake创建的可执行文件时(当前在Windows下进行测试,但在OS X下也发生了相同的行为),我收到未处理的错误“ React正在生产模式下运行”,这将导致应用程序暂停(AFAICT)。

我已经尝试在包装或制作之前设置NODE_ENV=production,但并没有改变。这是股票EF。

DevDeps:

"electron-forge": "^5.2.4",
"electron-prebuilt-compile": "4.0.0",

Deps:

"electron-compile": "^6.4.4",
"electron-debug": "^2.1.0",
"electron-devtools-installer": "^2.1.0",
"electron-squirrel-startup": "^1.0.0",
"react": "^16.4.1",

.compilerc

{
  "env": {
    "development": {
      "application/javascript": {
        "presets": [
          ["env", { "targets": { "electron": "1.6.0" } }],
          "react"
        ],

        "plugins": [
          "transform-decorators-legacy",
          "transform-class-properties",
          "transform-async-to-generator",
          "transform-es2015-classes",
          "transform-object-rest-spread",
          "react-hot-loader/babel",
          "babel-plugin-root-import"
        ],

        "sourceMaps": "inline"
      }
    },

    "production": {
      "application/javascript": {
        "presets": [
          ["env", { "targets": { "electron": "1.6.0" } }],
          "react"
        ],

        "plugins": [
          "transform-decorators-legacy",
          "transform-class-properties",
          "transform-async-to-generator",
          "transform-es2015-classes",
          "transform-object-rest-spread",
          "babel-plugin-root-import"
        ],

        "sourceMaps": "none"
      }
    }
  }
}

我可以提供所需的任何其他信息-这个问题使我感到困惑。

0 个答案:

没有答案