【问题标题】:SyntaxError: Unexpected token: operator (>)SyntaxError: Unexpected token: operator (>)
【发布时间】:2020-05-08 19:16:31
【问题描述】:

我在我的 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 run 时,代码运行完美,有人能告诉我真正的问题在哪里吗? react-bootstrap-typeahead库有问题吗?

【问题讨论】:

  • 这可能是您的构建管道中的问题。你是如何使用 uglify 的?如果禁用 uglify,问题是否仍然存在?

标签: javascript reactjs frontend uglifyjs


【解决方案1】:

我为这个库安装了低版本并且它工作正常

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-14
    • 1970-01-01
    • 2012-05-17
    • 2019-02-10
    • 2019-11-10
    • 2014-07-08
    相关资源
    最近更新 更多