一旦我添加import draw2d from "draw2d"
到我的导入中,我就会得到ReferenceError: jQuery is not defined
.
我尝试安装和添加 jquery 但仍然得到同样的错误......
import React, {Component} from "react";
import jQuery from "jquery";
import draw2d from "draw2d";
创建一个任意名称的文件,例如 import-jquery.js
import jquery from "jquery";
window.$ = window.jQuery = jquery;
import "import-jquery";
import "jquery-ui-bundle"; // you also need this
import "jquery-ui-bundle/jquery-ui.css";
import draw2d from "draw2d";
编辑:
别忘了...
npm install jquery
npm install jquery-ui-bundle