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

Drop required TypeScript dependency #117

Closed
medikoo opened this issue May 1, 2020 · 3 comments
Closed

Drop required TypeScript dependency #117

medikoo opened this issue May 1, 2020 · 3 comments

Comments

@medikoo
Copy link

medikoo commented May 1, 2020

In Serverless Framework we started to use dependency-tree to resolve dependencies tree for Node.js AWS lambdas, still we found out that it increased size of a Framework installation by 70MB, and size of our standalone binary iby 30MB

As we investigated, reason is that typescript started to be included in a project, when it's not really needed by it.

I believe right approach would be to not list typescript as a dependency, but require TypeScript to be installed aside (which naturally is the case) if one uses dependency-tree in context of TypeScript project.

Related issue on our side: serverless/dashboard-plugin#423

@mrjoelkemp
Copy link
Collaborator

Hey @medikoo. Thanks for filing the issue. If you an idea for how to make that work, I'm open to suggestions. I've wanted the plug and play nature since the early days of the project. I feel like peerDependencies could help, but not sure.

Alternatively, this module really only adds recursive traversal using the precinct and filing-cabinet modules. Filing-cabinet is likely the problem since it's pulling in typescript itself. You could assemble a module of the precinct detectives and filing cabinet resolvers that you care about. Maybe that's what the interface for this lib should have been, but it was built to be a single tool to handle frontend dependency tree concerns.

@medikoo
Copy link
Author

medikoo commented May 4, 2020

I feel like peerDependencies could help, but not sure.

peerDependencies still suggest, that's it's a mandatory dependency and not optional, so while not enforcing an install it gives a wrong hint I think.

Alternatively, this module really only adds recursive traversal using the precinct and filing-cabinet modules

Indeed problem is deeper, as precinct unconditionally depends on packages which detect dependencies in various browser formats and those packages unconditionally depend on various preprocessors (CSS, TypeScript etc)

In such case indeed, it may be hard to refactor this package, so it serves Node.js case cleanly without extra baggage.

@mrjoelkemp
Copy link
Collaborator

Thanks for your thoughts. You'd probably want this module with precinct and filing cabinet inlined, then drop all of the detectives and resolvers you don't need. It's not crazy effort.

Thanks for checking out dependency-tree and for the discussion. Cheers!

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

No branches or pull requests

2 participants