question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why not include 'dist' folder in npm package?

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
HardlyMiragecommented, Sep 5, 2016

There is no need to disable searchResolveModulesDirectories. Just add node_modules to the excludes array.

plugins: [
    new BowerWebpackPlugin({ excludes: ['node_modules'] })
]
1reaction
ShubhamGuptacommented, Aug 12, 2016

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
    })]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

npm install doesnt create dist folder - Stack Overflow
It will create the node_modules directory in your current directory (if one doesn't exist yet), and will download the package to that directory....
Read more >
Why not include 'dist' folder in npm package? #242 - GitHub
This is because of this setting: searchResolveModulesDirectories . It is set to true by default and thus searches for the bower components in ......
Read more >
What Really Gets Packaged?. Including and excluding files in ...
gitignore file, it is included in the npm package because we explicitly included it in the files field.
Read more >
npm-prepare-dist
NPM Prepare Dist CLI. Clean and prepare dist folder and all files before publishing your NPM library. Potentially smaller build and faster ...
Read more >
How to make your own npm package with typescript
It just uses tsc is used to compile the files to the dist folder, and the dist folder is published to npm !...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found