babel-plugin-react-transform icon indicating copy to clipboard operation
babel-plugin-react-transform copied to clipboard

Local path as an argument to "transform" does not resolve the path.

Open tokenvolt opened this issue 9 years ago • 0 comments

I have a .babelrc:

{
  "presets": ["es2015", "react"],
  "env": {
    "development": {
      "plugins": [
        // must be an array with options object as second item
        ["react-transform", {
          // must be an array of objects
          "transforms": [{
            // can be an NPM module name or a local path
            "transform": "./babel-plugins/react-transform-my",
            "imports": ["react"],
            "locals": ["module"]
          }]
          // by default we only look for `React.createClass` (and ES6 classes)
          // but you can tell the plugin to look for different component factories:
          // factoryMethods: ["React.createClass", "createClass"]
        }]
      ]
    }
  }
}

And in the same directory

babel-plugins/
└── react-transform-my
    └── index.js

When running the server I'm getting Module not found: Error: Cannot resolve 'file' or 'directory' ./babel-plugins/react-transform-my

If I provide the full path to the directory it is resolved correctly.

tokenvolt avatar Jul 05 '16 14:07 tokenvolt