Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack with React-Bootstrap, lots of 'Module Not Found' errors

I'm just getting started with Webpack, and I cannot figure out the best way to package React-Bootstrap.

Trying to package React-Bootstrap with React and React-Router. React and React-Router both worked as expected, but React-Bootstrap blew up with errors. I looked into Aliasing, using a vendor chunk, and just referencing React-Bootstrap like this:

import ReactBootstrap from 'react-bootstrap/dist/react-bootstrap';

But that seems clunky. I'm looking for the "correct" way to package React-Bootstrap with Webpack.

The errors:

ERROR in ./~/react-bootstrap/lib/utils/childrenValueInputValidation.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/singlePropFrom' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib/utils
 @ ./~/react-bootstrap/lib/utils/childrenValueInputValidation.js 12:39-85

ERROR in ./~/react-bootstrap/lib/BootstrapMixin.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/keyOf' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/BootstrapMixin.js 15:30-67

ERROR in ./~/react-bootstrap/lib/ButtonGroup.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/all' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/ButtonGroup.js 21:28-63

ERROR in ./~/react-bootstrap/lib/Button.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/elementType' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/Button.js 21:36-79

ERROR in ./~/react-bootstrap/lib/Col.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/elementType' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/Col.js 23:36-79

ERROR in ./~/react-bootstrap/lib/Dropdown.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/all' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/Dropdown.js 61:28-63

ERROR in ./~/react-bootstrap/lib/Dropdown.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/elementType' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/Dropdown.js 65:36-79

ERROR in ./~/react-bootstrap/lib/Dropdown.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/isRequiredForA11y' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/Dropdown.js 69:42-91

ERROR in ./~/react-bootstrap/lib/Grid.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/elementType' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/Grid.js 17:36-79

ERROR in ./~/react-bootstrap/lib/Jumbotron.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/elementType' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/Jumbotron.js 17:36-79

ERROR in ./~/react-bootstrap/lib/MenuItem.js
Module not found: Error: Cannot resolve module 'react-prop-types/lib/all' in /Users/alex/Documents/lifter/node_modules/react-bootstrap/lib
 @ ./~/react-bootstrap/lib/MenuItem.js 19:28-63

Is there something I'm missing?

edit I have already tried:

import { Something } from 'react-bootstrap';

It did not fix the problem.

I'll also add my webpack config:

module.exports = {
    entry: './entry.jsx',
    output: {
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'babel-loader'
            }
        ]
    },
    resolve: {
        extensions: ['', '.js', '.jsx']
    }
}
like image 813
thisisnotabus Avatar asked Mar 06 '26 00:03

thisisnotabus


2 Answers

[email protected] was missing a dependency.

Update to 0.26.1 to fix it.

like image 62
Jonny Buchanan Avatar answered Mar 07 '26 12:03

Jonny Buchanan


I could fixed it with:

$ npm install --force
like image 44
aarkerio Avatar answered Mar 07 '26 13:03

aarkerio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!