peakchen90 / babel-plugin-react-directives

A babel plugin that provides some directives for react(JSX), similar to directives of vue.
https://peakchen90.github.io/babel-plugin-react-directives
MIT License
96 stars 13 forks source link

not working with es6 #2

Closed Bnaimy closed 4 years ago

Bnaimy commented 4 years ago

hi I am really like this project because is very difficult to write code without directive I really I don't know why is not working , just if you can init a project with configuration of your project ??

peakchen90 commented 4 years ago

@Bnaimy Thank you for using and like it. Can you provide the babel configuration, code, error logs? Provide screenshots is better.

Bnaimy commented 4 years ago

this is file .babelrc inside package.json

{ "name": "app", "version": "1.0.0", "babel": { "presets": [ ], "plugins": ["react-directives"], "options": { "prefix": "x", "pragmaType": "React" } }

peakchen90 commented 4 years ago

@Bnaimy Your babel configuration looks like this:

{
  "name": "app",
  "version": "1.0.0",
  "babel": {
    "presets": [],
    "plugins": [
      "react-directives"
    ],
    "options": {
      "prefix": "x",
      "pragmaType": "React"
    }
  }
}

It is invalid, correct configuration:

{
  "name": "app",
  "version": "1.0.0",
  "babel": {
    "presets": [],
    "plugins": [
      [
        "react-directives",
        {
          "prefix": "x",
          "pragmaType": "React"
        }
      ]
    ]
  }
}

You can learn more at https://babeljs.io/docs/en/plugins#plugin-options, and optimize the documentation later.

And the option prefix = "x", pragmaType = "React" is the default option, you can omit the options section as follows:

{
  "name": "app",
  "version": "1.0.0",
  "babel": {
    "presets": [],
    "plugins": [
      "react-directives"
    ]
  }
}
Bnaimy commented 4 years ago

it's work thanks and waiting for features good jobs