语法错误:意外的令牌:运算符(>)

时间:2020-05-08 19:16:31

标签: javascript reactjs frontend uglifyjs

我在我的React包中使用react-bootstrap-typeahead库。

我已经按照文档添加了这些导入语句:

import { Typeahead } from "react-bootstrap-typeahead";
import "react-bootstrap-typeahead/css/Typeahead.css";

和渲染:

<Typeahead
  id="basic-typeahead-example"
  onChange={this.handleChange}
  options={this.state.options}
  placeholder="Choose..."
/>

尝试构建时,我得到:

static/js/main.4b322a5a.js from UglifyJs
SyntaxError: Unexpected token: operator (>) [./~/react-bootstrap-typeahead/~/escape-string-regexp/index.js:3,0]

当我执行npm运行时,由于代码可以完美运行,因此可以告诉实际的问题在哪里。 react-bootstrap-typeahead库有什么问题吗?

1 个答案:

答案 0 :(得分:0)

我为此库安装了较低版本,并且可以正常工作