Uncaught SyntaxError:scripts.bundle.js中的意外标识符

时间:2018-04-16 13:51:16

标签: jquery angular

我正在使用Angular 5.1.0,Node 8.9.3和CLI 1.6.0 我想将rm-emoji-picker(npm)添加到我的项目中 - 它需要jQuery。

我收到了邮件错误:

  

scripts.bundle.js:20371未捕获的SyntaxError:意外的标识符

它指向:

  public markContent(): void {
    const selection: any = window.getSelection();
    const range: any = selection.getRangeAt(0);

    if (range.startOffset !== range.endOffset) {
      if (this.markerEvent === 'p' || this.markerEvent === 'mark' || this.markerEvent === 'strong') {

        const textSeleted: string = selection.toString();
        const highlight: any = range.commonAncestorContainer;
        if (this.markerEvent !== 'mark') {
          const marker: any = document.createElement('mark');
          marker.setAttribute('class', this.colorMarker);
          range.surroundContents(marker);
          this.hideBubble();
          return;
        }

        const mark: any = range.commonAncestorContainer;

        mark.remove();
        range.deleteContents();
        range.insertNode(document.createTextNode(highlight.textContent));
        this.hideBubble();
      }
    }

  }

我尝试使用此this主题解决此问题,但没有任何更改。

我的angular-cli.json看起来像是:

import $ from "jquery"; // ERROR MARKED THERE
import EmojiEditor from "./EmojiEditor";
import EmojiCategory from "./EmojiCategory";
import Converters from "./Converters";
import Tooltip from "rm-tooltip";

0 个答案:

没有答案