Lobos/react-ui

Unexpected token export

pasBone opened this issue · 5 comments

export const Checkbox = require('./Checkbox')
Uncaught SyntaxError: Unexpected token export

我是直接安装然后 require('rctui') 就报这个错

Lobos commented

babel,webpack有没有配置?新项目的话,执行一下

node node_modules/rctui/cli/init.js all

这个安装后也不能用啊,有没有个比较完整的使用教程啊

Lobos commented

安装完执行node devServer.js 会启动一个服务,可以看到一个demo的,按那个demo配置就可以了
也可以参考这个项目的配置,不过有点复杂,有后端的代码 https://github.com/Lobos/hydra

还是没搞懂怎么用的,好像拿来直接用不行,babel什么的都装了,还是报这个错,@Lobos 能写个完整的使用教程吗

Lobos commented

加了一个编译过的文件,如果编译不了的话,使用这个文件吧

// html
<script src="https://unpkg.com/rctui/dist/index.js"></script>
// webpack config
externals: {'react': 'React', 'react-dom': 'ReactDOM', 'rctui': 'rctui'},
// jsx
import { Form } from 'rctui'
...