引导错误“;未定义jQuery";在Visual Studio 2017 react/redux项目中
关于这个错误有很多文档,但对于使用VisualStudio的非网页包/用户似乎没有任何答案 我已经尝试了所有与Web包无关的错误,例如在窗口上声明jQuery,但似乎没有任何效果,下面是我的index.tsx文件引导错误“;未定义jQuery";在Visual Studio 2017 react/redux项目中,jquery,reactjs,typescript,Jquery,Reactjs,Typescript,关于这个错误有很多文档,但对于使用VisualStudio的非网页包/用户似乎没有任何答案 我已经尝试了所有与Web包无关的错误,例如在窗口上声明jQuery,但似乎没有任何效果,下面是我的index.tsx文件 import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap/dist/css/bootstrap-theme.css'; import * as $ from 'jquery'; import 'popper.js'; im
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import * as $ from 'jquery';
import 'popper.js';
import '../node_modules/bootstrap/js/dropdown.js';
import './styles/Site.css'
import * as React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { BrowserRouter, Route } from 'react-router-dom';
import configureStore from './store/configureStore';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
(window as any).jQuery = $;
(window as any).$ = $;
const store = configureStore();
render(
<BrowserRouter>
<Provider store={store}>
<Route path="/" component={App} />
</Provider>
</BrowserRouter>,
document.getElementById('root'));
registerServiceWorker();
import'bootstrap/dist/css/bootstrap.css';
导入'bootstrap/dist/css/bootstrap theme.css';
从“jquery”导入*为$;
导入“popper.js”;
导入“../node_modules/bootstrap/js/dropdown.js”;
导入“./styles/Site.css”
从“React”导入*作为React;
从'react dom'导入{render};
从'react redux'导入{Provider};
从“react router dom”导入{BrowserRouter,Route};
从“/store/configureStore”导入configureStore;
从“./App”导入应用程序;
从“./registerServiceWorker”导入registerServiceWorker;
(窗口如有)。jQuery=$;
(如有窗口)。$=$;
const store=configureStore();
渲染(
,
document.getElementById('root');
registerServiceWorker();
在加载时,我得到了错误
ReferenceError:jQuery未定义。/node_modules/bootstrap/js/dropdown.js
我也尝试过在应用程序组件上导入dropdown.js,但仍然一无所获
它看起来确实是一个补丁,但是VisualStudio没有网页包配置文件,所以我也不能尝试这些修复。我不确定VisualStudio是否在幕后使用webpack
以前是否有人遇到过此问题?请尝试移动
(任何窗口)。jQuery=$代码>上面的行import'../node_modules/bootstrap/js/dropdown.js'代码>明白了,谢谢!我原以为进口高于可变声明