juniorgarcia juniorgarcia -4 years ago 67
Node.js Question

webpack: how to get JavaScript from "bower_components", not from "node_modules"

Due the use of

as part of the compiling tasks using Gulp, I can't
modules using webpack from
dir because I would mess the CSS's / images / fonts processing tasks in my current asset system. So, how can I tell webpack "when I
something, search into
folder instead in

Answer Source

You can use the resolve.modules option in your config:

resolve: {
  modules: ['bower_components']

With this it won't check node_modules at all, but if you'd like to fallback to node_modules when the module is not found in bower_components, you can add it as well, the priority is from left to right:

resolve: {
  modules: ['bower_components', 'node_modules']
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download