How to ignore non-js files with babel/register

You can use babel-plugin-transform-import-ignore to ignore matched imports. All matched import statements will be removed after compilation.

{
  plugins: [
    [
      "babel-plugin-transform-import-ignore",
      {
        patterns: [".scss"]
      }
    ]
  ]
}


Turns out it was node that needed the tweak:

require.extensions['.scss'] = () => {};

You can create .babelrc file and set ignore rule:

{
  "stage": 0,
  "ignore": [
    "*.scss"
  ]
}

You can read more about this here - https://babeljs.io/docs/usage/babelrc/