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.

devDependencies are part of the binary

See original GitHub issue

@leafac What a cool project! Thank you very much for your work on this. Once ARM support is ready it is a very interesting alternative to pkg although the source code is not hidden and must be evaluated first.

After some tests with my project on Linux I found out that all of my devDependencies are part of the resulting binary (file size is ca. 42 MB, ca. 160 MB after extraction). In the README you write:

You don’t need to npm prune --production and npm dedupe, because caxa will do that for you from within the build directory. (Otherwise, if you tried to npm prune --production you’d uninstall caxa, which should probably be in devDependencies.)

but this seems not to be the case for me. My current workaround:

  1. Install caxa globally with npm install -g caxa
  2. Delete the node_modules folder of my project, it seems to be unused by caxa
  3. Delete the devDependencies section in my package.json
  4. Run caxa as recommended, this seems to cause the installation of all remaining dependencies from package.json in the build directory of caxa.

Now, I get a working binary with file size of ca. 15 MB (ca. 39 MB after extraction). The result is impressive. Is there something wrong with this approach to avoid the devDependencies?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fcastilloeccommented, May 29, 2021

@leafac After further testing, I’ve realized that npm dedupe reinstalls all dependencies including all devDependencies, undoing what npm prune --production did. A simple fix to this issue would be to just remove this line https://github.com/leafac/caxa/blob/master/src/index.ts#L31. Or at the very least run prune after dedupe and not before.

PR #8 could also fix this issue, but I think that PR is targeted at introducing a new feature rather than fixing this issue. It just happens to fix this issue as a side effect.

1reaction
iCrazyBlazecommented, Apr 4, 2021

This is happening to me on Windows. Caxa itself, along with other stuff specified in devDepenencies is being packaged into the final binary. node_modules extracted by final binary package.json npm prune --production doesn’t seem to be making a massive difference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Node / npm: How to manage globally installed ...
I'm building a Node module with devDependencies that should be globally installed, such as jasmine-node and jshint. What I essentially need is ...
Read more >
Difference between dependencies, devDependencies and ...
A dependency is a library that a project needs to function effectively. DevDependencies are the packages a developer needs during development. ...
Read more >
Understanding dependencies inside your Package.json
json is that they're both objects with multiple key/value pairs. Every key in dependencies , devDependencies , and peerDependencies is a name ...
Read more >
package.json - npm Docs
Description. This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just...
Read more >
Make commands in dev-dependencies available to run #2267
Let's say your project needs various binary crates for development, for example because they're called by non-rust glue and utility scripts.
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