thisisnotabus
thisisnotabus

Reputation: 2069

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']
    }
}

Upvotes: 3

Views: 5607

Answers (2)

aarkerio
aarkerio

Reputation: 2364

I could fixed it with:

$ npm install --force

Upvotes: 1

Jonny Buchanan
Jonny Buchanan

Reputation: 62813

[email protected] was missing a dependency.

Update to 0.26.1 to fix it.

Upvotes: 4

Related Questions