React CSS Modules, babel-plugin-react-css-modules with electron-compile no webpack

jor*_*cke 5 babeljs electron react-css-modules electron-forge babel-plugin-react-css-modules

我正在尝试开始使用react-css-modulesw/ babel-plugin-react-css-modules。目前我有一个运行 react的电子锻造应用程序。

我的.compilerc看起来如下:

{
  "env": {
    "development": {
      "application/javascript": {
        "presets": [
          ["env", { "targets": { "electron": "2.0.0" } }],
          "es2015", "stage-0", "react"
        ],
        "plugins": ["transform-decorators-legacy", "transform-runtime"],
        "sourceMaps": "inline"
      }
    },
    "production": {
      "application/javascript": {
        "presets": [
          ["env", { "targets": { "electron": "2.0.0" } }],
          "es2015", "stage-0", "react"
        ],
        "plugins": ["transform-decorators-legacy", "transform-runtime"],
        "sourceMaps": "none"
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我的理解.compilerc类似于.babelrc(我没有.babelrc文件),请参阅:electron-compile(electron-forge 使用的 - 我猜)

但是,.css我的项目目录中有文件,如果我运行,DEBUG=* electron-forge start我会看到这些文件正在通过(未预处理)

我曾尝试添加react-css-modules到我的plugins线.compilerc,并同时创造了新的.babelrc

.compilerc

 "env": {
        "development": {
          "application/javascript": {
            "presets": [
              ["env", { "targets": { "electron": "2.0.0" } }],
              "es2015", "stage-0", "react"
            ],
            "plugins": ["react-css-modules", "transform-decorators-legacy", "transform-runtime"],
            "sourceMaps": "inline"
          }
        },
Run Code Online (Sandbox Code Playgroud)

.babelrc

{
  "env": {
    "development": {
      "application/javascript": {
        "plugins": ["react-css-modules"]
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

两者都在运行后yarn add babel-plugin-react-css-modules -s,但当我尝试运行时,我仍然得到一个编译错误 no compiler found:

import "mystyles.css"