I'm just getting started with Webpack (for use w/ React), and I'm running into an issues when trying to pull in bower packages. I have installed pickadate through bower and I have the following webpack config (original). Looking at the pickadate bower.json file, it has an array instead of just a string for main as it needs to pull in multiple js and css files.
// ./webpack/dev.config.js
// ...
resolve: {
modulesDirectories: [
'src',
'node_modules',
'bower_components'
],
plugins: [
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
)
],
extensions: ['', '.json', '.js']
},
My Component:
import React, {Component, PropTypes} from 'react';
import $ from 'jquery';
import pickadate from 'pickadate';
class DateInput extends Component {
// ...
}
I get the following errors for jquery and pickadate modules:
@ ./src/components/forms/DateInput.js 17:14-31
[0] ./src/components/forms/DateInput.js
[0] Module not found: Error: Cannot resolve module 'jquery' in /Users/chris7519/Desktop/react-redux-universal-hot-example/src/components/forms
[0] resolve module jquery in /Users/chris7519/Desktop/react-redux-universal-hot-example/src/components/forms
[0] looking for modules in /Users/chris7519/Desktop/react-redux-universal-hot-example/src
[0] /Users/chris7519/Desktop/react-redux-universal-hot-example/src/jquery doesn't exist (module as directory)
[0] resolve 'file' jquery in /Users/chris7519/Desktop/react-redux-universal-hot-example/src
[0] resolve file
[0] /Users/chris7519/Desktop/react-redux-universal-hot-example/src/jquery doesn't exist
[0] /Users/chris7519/Desktop/react-redux-universal-hot-example/src/jquery.json doesn't exist
[0] /Users/chris7519/Desktop/react-redux-universal-hot-example/src/jquery.js doesn't exist
// ...
Module not found: Error: Cannot resolve module 'pickadate' in /Users/chris7519/Desktop/react-redux-universal-hot-example/src/components/forms
[0] resolve module pickadate in /Users/chris7519/Desktop/react-redux-universal-hot-example/src/components/forms
[0] looking for modules in /Users/chris7519/Desktop/react-redux-universal-hot-example/src
[0] /Users/chris7519/Desktop/react-redux-universal-hot-example/src/pickadate doesn't exist (module as directory)
[0] resolve 'file' pickadate in /Users/chris7519/Desktop/react-redux-universal-hot-example/src
[0] resolve file
[0] /Users/chris7519/Desktop/react-redux-universal-hot-example/src/pickadate doesn't exist
[0] /Users/chris7519/Desktop/react-redux-universal-hot-example/src/pickadate.json doesn't exist
[0] /Users/chris7519/Desktop/react-redux-universal-hot-example/src/pickadate.js doesn't exist
I attempted to install both jquery and pickadate through npm, but I still get the error Cannot find module 'pickadate'