Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website dependencies in graphile-worker package.json #443

Closed
lauri865 opened this issue Mar 5, 2024 · 6 comments · Fixed by #444
Closed

Website dependencies in graphile-worker package.json #443

lauri865 opened this issue Mar 5, 2024 · 6 comments · Fixed by #444
Labels

Comments

@lauri865
Copy link

lauri865 commented Mar 5, 2024

Summary

I was wondering why my server docker image includes 10mb of fontawesome icons. Turns out graphile-worker is the culprit.

All of the following files should be moved to devDependencies – as they are not dependencies of the built lib:

"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@types/debug": "^4.1.10",
"@types/pg": "^8.10.5",

Happy to open a PR if needed.

@benjie
Copy link
Member

benjie commented Mar 5, 2024

Oops! I should have caught this during review; thanks for the heads up!

@benjie
Copy link
Member

benjie commented Mar 5, 2024

Fix released in 0.16.4

@lauri865
Copy link
Author

lauri865 commented Mar 5, 2024

Appreciate the quick fix. Not as big of an issue, but I think types should still be moved to devDependencies as well.

@benjie
Copy link
Member

benjie commented Mar 5, 2024

That would be a breaking change for @types/pg since we expose things that depend on these types (for example our public interface exports a dependency on pg.Pool, for which pg module would be required). Probably @types/debug could be moved, but 🤷‍♂️

@lauri865
Copy link
Author

lauri865 commented Mar 5, 2024

In theory I could agree. But practically, I can't think of a reason why anyone would need typescript types in a production install / build? Even if you do, you're highly unlikely to be able to use npm install --prod anyways, as you'll miss out on the types from many other packages (unless they are meant to be bundled, which is a whole different topic, but bundlers have access to devdeps anyways). And let's say you even do get away with it by some miracle, then what use are types in production if you don't build your app? It's not like you get runtime errors.

There's another 2 packages in my case that add nodejs types to my production build. Both are by accident by the authors, never by design. But they do add 10mb+ of dead weight into the build. This stuff matters in the serverless world.

@benjie
Copy link
Member

benjie commented Mar 5, 2024

When you install a module from npm you only ever install the dependencies of that module; devDependencies are for your application alone, not for its dependencies.

https://stackoverflow.com/a/46011417/141284

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants