Senad Metiljevic
Senad Metiljevic

Reputation: 155

Using bower modules with Webpack 2

I am new to Webpack and I started with Webpack2. I can't manage to use require or import of modules from bower_components folder. Is it possible to do so and if it is can you provide me an example or something.

This is my webpack.config file:

enter image description here

Upvotes: 5

Views: 3197

Answers (1)

Michael Jungo
Michael Jungo

Reputation: 32982

You can configure resolve.modules to also look in bower_components.

resolve: {
  modules: ['bower_components', 'node_modules']
}

This will first look into bower_components and if it can't find the module it will look into node_modules. If you don't inlcude node_modules you won't be able to use packages installed from npm.

Upvotes: 6

Related Questions