使用npm react-tools编译jsx

来源:互联网 发布:被墙域名查询 编辑:程序博客网 时间:2024/06/05 11:49

虽然react-tools已经被弃用,但是对于只想编译JSX的项目仍然可以使用。

首先安装好nodejs运行环境。

用如下命令安装nrm(NPM registry 管理工具):

$ npm install -g nrmnpm WARN deprecated coffee-script@1.7.1: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)C:\Users\******\AppData\Roaming\npm\nrm -> C:\Users\******\AppData\Roaming\npm\node_modules\nrm\cli.js+ nrm@1.0.2added 328 packages in 124.447s$ nrm ls  npm ---- https://registry.npmjs.org/  cnpm --- http://r.cnpmjs.org/* taobao - https://registry.npm.taobao.org/  nj ----- https://registry.nodejitsu.com/  rednpm - http://registry.mirror.cqupt.edu.cn/  npmMirror  https://skimdb.npmjs.com/registry/  edunpm - http://registry.enpmjs.org/$ nrm use cnpm   Registry has been set to: http://r.cnpmjs.org/

安装react-tools:

$ npm install -g react-toolsnpm WARN deprecated react-tools@0.13.3: react-tools is deprecated. For more information, visit https://fb.me/react-tools-deprecatedC:\Users\******\AppData\Roaming\npm\jsx -> C:\Users\******\AppData\Roaming\npm\node_modules\react-tools\bin\jsx+ react-tools@0.13.3added 31 packages in 59.379s

编译reaxt jsx模板:

$ jsx --watch src/ build/built Module("index")["index"]


原创粉丝点击