We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
To use components from bower you need to add two things to webpack:
bower_components
main
bower.json
See configuration resolve.modulesDirectories and list of plugins ResolverPlugin.
resolve.modulesDirectories
ResolverPlugin
var path = require("path"); var webpack = require("webpack"); module.exports = { resolve: { modulesDirectories: ["web_modules", "node_modules", "bower_components"] }, plugins: [ new webpack.ResolverPlugin( new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(".bower.json", ["main"]) ) ] }
In many cases modules from npm are better than the same module from bower. Bower mostly contain only concatenated/bundled files which are:
So prefer to use the CommonJs-style module and let webpack build it.
bower package vs. npm package
Note: the bower package is built with browserify and envify (NODE_ENV = "production")
NODE_ENV = "production"
So we compare four configurations:
a) webpack + bower package (DefinePlugin makes no difference here as envify already removed debug code)
DefinePlugin
b) webpack + bower package + module.noParse for react
module.noParse
c) webpack + npm package
d) webpack + npm package + DefinePlugin with NODE_ENV = "production"
(webpack 1.3.0-beta8, react 0.10.0, bundle size minimized)