简体   繁体   中英

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:

在此输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM