# babel-plugin-rax-to-react

> Transform rax component code to react version.

Latest version **0.3.0** (published 2019-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-rax-to-react
pnpm add babel-plugin-rax-to-react
yarn add babel-plugin-rax-to-react
bun add babel-plugin-rax-to-react
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2019-09-25 |
| First published | 2019-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | yq12315@gmail.com |
| Maintainers | kisnows |
| Keywords | babel-plugin, rax, react |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-rax-to-react
- Repository: https://github.com/kisnows/babel-plugin-rax2react
- Homepage: https://github.com/kisnows/babel-plugin-rax2react#readme
- Issues: https://github.com/kisnows/babel-plugin-rax2react/issues
- npm.io page: https://npm.io/package/babel-plugin-rax-to-react

## Dependencies (1)

- [@babel/types](https://npm.io/package/@babel/types.md) ^7.5.5

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2019-09-25
- 0.2.0 — 2019-08-22
- 0.1.0 — 2019-08-01
- 0.0.2 — 2019-07-31

## README

# babel-plugin-rax2react
支持转换 rax 代码为 react 代码。
# How To Use

添加此插件到 bebel 配置中

```js
module.exports = function(api) {
  api.cache(false);
  const presets = [
    [
      "@babel/preset-env",
      {
        useBuiltIns: "false",
        corejs: 3,
        modules: false,
        debug: false,
      },
    ],
    "@babel/preset-react",
  ];
  const plugins = [
    require.resolve('babel-plugin-rax-to-react'),
    require.resolve("@babel/plugin-proposal-export-default-from"),

    // Stage 2
    [require.resolve("@babel/plugin-proposal-decorators"), { legacy: true }],
    require.resolve("@babel/plugin-proposal-function-sent"),
    require.resolve("@babel/plugin-proposal-export-namespace-from"),
    require.resolve("@babel/plugin-proposal-numeric-separator"),
    require.resolve("@babel/plugin-proposal-throw-expressions"),

    // // Stage 3
    require.resolve("@babel/plugin-syntax-dynamic-import"),
    require.resolve("@babel/plugin-syntax-import-meta"),
    [
      require.resolve("@babel/plugin-proposal-class-properties"),
      { loose: true },
    ],
    require.resolve("@babel/plugin-proposal-json-strings"),
    require.resolve("@babel/plugin-proposal-object-rest-spread"),
  ];

  return {
    presets,
    plugins,
  };
};

```
如果模块中使用了外部 css 文件来做样式布局，那么需要结合 webpack 以及 css-loader ，参考 css-loader 配置:
```js
{
  loader: require.resolve('css-loader'),
  options: {
    importLoaders: 2,
    modules: {
      mode: 'local',
      localIdentName: '[path][name]__[local]--[hash:base64:5]',
    },
    // sourceMap: !!DEV,
  },
}
```

---
_Source: https://npm.io/package/babel-plugin-rax-to-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
