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.

built dist folder contains a ton of node_modules folders full of README.md files

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

I seem to have the same problem as described in issue #2418, so the fix doesn’t seem to work on my side. However in my case, I have 2x node_modules in my project because I separated Cypress into its own folder with its own node_modules. I did not have that problem in previous version 13.x of ng-packagr, so that seems like a regression

root
 node_modules
 src
 test
   cypress
     node_modules

image

How To Reproduce

my project is open sourced and can be clone from here https://github.com/ghiscoding/Angular-Slickgrid

running npm run packagr should reproduce the issue

Expected Behaviour

in my case the test/ folder should not be included, I also thought that my .npmignore would be excluding that folder when publishing but it turns out that since it’s not part of the dist/ folder, then it will completely skip the .npmignore (as explained in this SO) and so my unwanted test/ folder is being publishing as can be seen in this unpkg link: https://unpkg.com/browse/angular-slickgrid@5.0.0/

What I could do in the meantime is to copy my root .npmignore inside the dist/ folder after it’s packaged, but it’s quite inconvenient but still is the only temporary solution that works and I’ll go with that for now until the issue is fixed (hopefully)

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: ^14.2.1
@angular/*: ^14.1.2
typescript: ~4.7.4
rxjs: ^7.5.6
node: 16.18.0
npm/yarn: 8.10.0

Please include all version numbers that might be relevant, e.g. third-party libraries

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Oct 24, 2022

Note there might be one think I forgot to mention, I have 2 folders with node_modules, I moved Cypress E2E install into it’s own folder and you probably did not installed it when you first tried to replicate and it might be the reason you don’t see it on your side, so there’s 2 installs to run

Indeed that causes the problem.

0reactions
github-actions[bot]commented, Nov 24, 2022

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

satellite.min.js · Issue #80
I saw on the readme page that there is support for script tag, ... then find satellite.min.js in node_modules/satellite.js/dist directory.
Read more >
The node_modules problem
As I've said, the problem when copying node_modules folder from one place to another is not the size, it is the amount of...
Read more >
How to npm publish specific folder but as package root
Just make sure your dist folder contains a package.json file. You can easily do that by adding a cp to your postbuild script:...
Read more >
Check in your node_modules folder
It is considered a best practice to add your node_modules folder to your .gitignore file when you are building your JavaScript application.
Read more >
NPM Install with just GitHub
The built dist folder is the one published to the NPM registry. ... Lots of stray files - no user of this 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