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

497 Views Asked by At

I am trying to start using react-css-modules w/ babel-plugin-react-css-modules. At present I have an electron-forge application running react.

My .compilerc looks like the following:

{
  "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"
      }
    }
  }
}

It's my understanding that .compilerc is analogous to .babelrc (I do not have a .babelrc file), see: electron-compile (which electron-forge makes use of - I guess)

However, I have .css files in my project directory, and if I run DEBUG=* electron-forge start I see that the are just being passed through ( not preprocessed )

I have tried adding react-css-modules to my plugins line in .compilerc and also creating a new .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"
          }
        },

.babelrc

{
  "env": {
    "development": {
      "application/javascript": {
        "plugins": ["react-css-modules"]
      }
    }
  }
}

Both of which after running yarn add babel-plugin-react-css-modules -s, but I still get a compilation error no compiler found when I attempt to run:

import "mystyles.css"

0

There are 0 best solutions below