Using bower modules with Webpack 2

I am new to Webpack and I started working with Webpack2. I cannot use the requirement or import modules from the bower_components folder. Is it possible to do this, and if it is possible, you can give me an example or something like that.

This is my webpack.config file:

enter image description here

+4
source share
1 answer

You can customize resolve.modulesto look at bower_components.

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

First, consider bower_components, and if he cannot find the module, he will consider node_modules. If you do not enable it node_modules, you will not be able to use packages installed from npm.

+5
source

Source: https://habr.com/ru/post/1672063/


All Articles