bower-webpack-plugin icon indicating copy to clipboard operation
bower-webpack-plugin copied to clipboard

Resolve priority

Open MaxNamazov opened this issue 9 years ago • 4 comments

Hi! I found that this plugin ignores resolve.modulesDirectories configuration option. In my case it is set to ["node_modules", "bower_components"] and I want webpack to look at node_module first, but instead I get my deps that are available in both node_modules and bower_components bundled from last one. May be I just missed something.

MaxNamazov avatar Jun 22 '15 11:06 MaxNamazov

I have the same issue! :+1: See my message in https://github.com/webpack/enhanced-resolve/pull/15#issuecomment-113864959

mathieumg avatar Jun 22 '15 15:06 mathieumg

Yes, thnx, I've already found your solution and have applied it to my build setup. It works perfectly. However PR is not accepted yet. And I also believe bower-webpack-plugin should have options to handle such cases

MaxNamazov avatar Jun 22 '15 20:06 MaxNamazov

And I also believe bower-webpack-plugin should have options to handle such cases

Yep, right now the problem (for this plugin) is not that it ignores resolve.modulesDirectories (see https://github.com/lpiepiora/bower-webpack-plugin/blob/master/lib/bower-plugin.js#L63) but rather that it specializes in finding Bower modules exclusively, so it would overlook any module that doesn't have a bower.json (by default, but the value of the manifestFiles configuration otherwise) file in it. (See https://github.com/lpiepiora/bower-webpack-plugin/blob/master/lib/bower-plugin-manifest-resolver.js#L116-L118) You could also add package.json to the manifestFiles list, but that is unnecessary extra configuration maintenance and nothing says this plugin wouldn't do "Bower stuff" that doesn't work against a npm module.

Thus, that is why I like the solution in the enhanced-resolve PR better since it's tied more closely to the Webpack pipeline and lookup strategy.

mathieumg avatar Jun 22 '15 20:06 mathieumg

Hi!.

Sorry for my ignorance, but I dont understand how to fix this.

In my case I want to use stamplay-js-sdk only available in Browser but I cant. I would just load this library (and their dependents store and Q) of bower, the rest continue require from NPM

I created a sample app to tests this and post this question on stackoverflow too

Error when run ./node_modules/.bin/webpack

ERROR in ./app.js
Module not found: Error: Cannot resolve module 'stamplay-js-sdk' in {{OMITED}}\webpackBowerStarter
 @ ./app.js 7:15-41

Any help will be appreciated. :)

Ridermansb avatar Nov 04 '15 14:11 Ridermansb