When i use webpack to compile file, console show these error message.
ERROR in debug (bower component)
Module not found: Error: Cannot resolve 'file' or 'directory' ./dist/debug.js in /Users/stevenjlho/Work/v4s/htdocs/node_modules/debug
@ debug (bower component) 1:17-43
Npm package version is 2.2.0.
i have the same problem
+1
Is there a reason that webpack thinks its a bower component rather than an npm module?
I had to npm install debug && cd debug && make in order for the dist directory to show up. Not sure if that's by design or not.
@TooTallNate probably the bower.json file
Maybe we just remove it?
idk.. sounds like having bower support breaks webpack support. i don't use either so i'd say remove all the things =)
Maybe I use Bower Webpack Plugin, when I remove this plugin, console don't show error message.
+1
Same problem here.
Could you please publish a new release with the dist/ folder included? I can see that you disabled this in 43b0d51, but it is needed by everyone not using a module loader (or one, that is not compatible).
+1 , i am getting the same error >>
ERROR in debug (bower component)
Module not found: Error: Cannot resolve 'file' or 'directory' ./dist/debug.js in D:\omsnode_modules\debug @ debug (bower component) 1:17-43
Inside the debug directory there is no directory dist . MakeFile in the debug directory says
all: dist/debug.jsIs this is the reason which is causing it?
@gitsubham Are you using Webpack too? It seems weird, that a npm package is recognized as a bower component. It looks like webpack supports all kinds of JS module formats, so you should be able to just include the browser.js in the package. With a module loader you should not need the dist/ folder.
As an alternative you could require my fork https://github.com/nhaesler/debug.git#100cf7e, so you'll get the dist/ folder, until my PR #251 is merged.
How about appending bower.json to .npmignore?
How about appending bower.json to .npmignore?
that makes sense to me
@nathasm thank you, it worked out
For anyone using bower-webpack-plugin: The main issue is that it is recognizing the npm package as a bower component. This is because of this setting: searchResolveModulesDirectories. It is set to true by default and thus searches for the bower components in resolve.modulesDirectories. This probably points to your node_modules directory which is causing the plugin to see the npm package as a bower component. To resolve, simply set this as false in your webpack config. Hope this helps!
{
plugins: [new BowerWebpackPlugin({
modulesDirectories: [path],
manifestFiles: "bower.json",
includes: /.*/,
excludes: [],
searchResolveModulesDirectories: false
})]
}
There is no need to disable searchResolveModulesDirectories. Just add node_modules to the excludes array.
plugins: [
new BowerWebpackPlugin({ excludes: ['node_modules'] })
]
@ShubhamGupta, @HardlyMirage what if you want to install some Bower package with npm/yarn (so you do not want to exclude node_modules from BowerWebpackPlugin)?
For example: angular-bootstrap-toggle can be installed as Node-dependency but it does not use any module system because it just an Bower-package.
Closing this for now.
Most helpful comment
There is no need to disable
searchResolveModulesDirectories. Just addnode_modulesto theexcludesarray.