So, I'm new to ASP.NET MVC.
I have a web application in ASP.NET MVC and I'm trying to add react-bootstrap to it. It's already using React/ReactDOM.
I did
npm install --save react-bootstrap
and react-bootstrap is in the node_modules folder in the project.
I added react-bootstrap to the dependencies in the Package.json file.
"dependencies": {
......
"react-bootstrap": "^0.30.0"
},
I added react-bootstrap to the externals in the webpack.config.js file.
externals:
{
'react-bootstrap':
{
"var": 'ReactBootstrap',
web: 'ReactBootstrap',
root: 'ReactBootStrap',
commonjs2: 'ReactBootstrap',
commonjs: 'ReactBootstrap',
amd: 'ReactBoostrap'
},
.....
}
In the Layout.cshtml, I did added a script tag with the src attribute specifying the location of the reactbootstrap.js file in node_modules folder.
<script src="@Url.Content("~/node_modules/react-bootstrap/dist/react-bootstrap.min.js")"></script>
But when I do
import * as ReactBootStrap from 'react-bootstrap';
in the Dashboard.tsx file, it says it can't find the module.
What's missing?