[英]Importing draw2d in react causes jquery reference error
一旦我將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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.