babel-plugin-transform-rax2react

2.3.12 • Public • Published

babel-plugin-transform-rax-to-react

transfrom rax base component to react base

This plugin will transform rax E6 module to react.

attention

  1. react base module will not be transformed.

  2. rax's third party modules should provider src folder to build react version which like nuke did

  3. This plugin will not install react / react-dom / prop-types in current workspace. You have the choice on how to deal with these dependencies [cdn,umd].

usage

Add this plugin at .babelrc or babel-loader's options like below:

step1

babel-plugin-transform-rax2react should be the first plugin of babel plugin setting.

.babelrc:

{
  "presets": ["es2015", "rax"],
  "plugins": ["transform-rax2react"]
}

step2

Add babel-rax2react-polyfill for rax special function.

webpack.config.js

entry:[require.resolve('babel-rax2react-polyfill'),index.js]

eg. How to deal with 3rd party rax modules. like nuke packages.

webpack.config.js

alias:{
    "nuke-text":"nuke-text/src/",
     ...
}

todo

针对表达式展开 JSXSpreadAttribute 需要对待展开的内容包装方法,当待展开属性包含style时包裹adjust函数。

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-transform-rax2react

Weekly Downloads

41

Version

2.3.12

License

none

Unpacked Size

16.7 kB

Total Files

5

Last publish

Collaborators

  • doub
  • leanhunter