Kun*_*nal 1 reactjs eslint gulp-uglify react-router
当使用gulp uglify和eslint时,我会得到意想不到的字符'''.
<td><Link to={`/user/${u.userId}`}>{u.UserName}</Link></td>
Run Code Online (Sandbox Code Playgroud)
在gulp文件中
Gulp.task('js', function(){
Browserify(GulpConfig.paths.mainJs, { debug: (production() ? false : true)})
.transform(Reactify)
.bundle()
.on('error', console.error.bind(console))
.pipe(Source('bundle.js'))
.pipe(production(Buffer()))
.pipe(production(Uglify().on('error', gulpUtil.log)))
.pipe(Gulp.dest(GulpConfig.paths.dist + '/scripts'))
.pipe(Connect.reload());
});
Run Code Online (Sandbox Code Playgroud)
怎么处理?
使用ES6模板字符串要求您通过像Babel这样的工具来转换代码,而目前您还没有这样做.
但是,由于您正在使用,reactify您可以添加该选项{"es6": true}以参与某些ES6功能,例如箭头功能或模板字符串.
.transform(Reactify, {es6: true})
Run Code Online (Sandbox Code Playgroud)
当前支持的整个功能集是箭头函数,休息参数,模板,对象简短表示法和类.
如果你计划长期使用React和ES6,我当然建议使用Babel作为你的一站式服务,而不是用浏览器完成所有爵士乐,重新获得,这两者都是很棒的工具,并且在过去帮助了我很多.
| 归档时间: |
|
| 查看次数: |
870 次 |
| 最近记录: |