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

Do not copy devDependencies into the packaged app, prior to the prune step #198

Closed
mhagmajer opened this issue Nov 17, 2015 · 6 comments
Closed
Labels
enhancement Feature request

Comments

@mhagmajer
Copy link

My dev dependencies are quite large (babel alone is over 300MB). The electron-packager analyses all those files which causes the build time to take a long time. I ended up explicitly ignoring all node modules that I want:

--ignore='^/node_modules/(?!(invariant|mongodb))'

Why not make it the default behaviour of electron-package to ignore dev dependencies?

@malept
Copy link
Member

malept commented Nov 17, 2015

Thanks for the feature request, this is a duplicate of #35 (making --prune default).

@malept malept closed this as completed Nov 17, 2015
@mhagmajer
Copy link
Author

@malept, I don't think these are the same issues. The problem that I have is that electron-packager looks at all the modules that are in my devDependencies which take a lot of time given their size. Adding --prune flag doesn't help it. I was only able to mitigate that problem by adding the ignore flag mentoned above.

@malept
Copy link
Member

malept commented Nov 17, 2015

(I edited the issues so that the comment from #35 is here, as that's where it's relevant.)

I don't think these are the same issues. [...]

Fair enough. I can't think of a good reason to not ignore devDependencies. Feel free to create a PR to change the behavior. You may have some trouble now that NPM 3 has a flat node_modules folder.

@malept malept reopened this Nov 17, 2015
@malept malept added enhancement Feature request help wanted Needs a contributor from the community and removed duplicate labels Nov 17, 2015
@malept
Copy link
Member

malept commented Feb 28, 2016

See also: #235

@malept
Copy link
Member

malept commented Oct 30, 2016

I saw a really poor implementation of this the other day. I believe the correct way to do it is something like this (pseudocode):

let package = require('./package.json');

// calculateDependencyTree returns a flat list of versioned dependencies, including
// sub-dependencies, for a given list of packages.
dependenciesToExclude() {
  let dependencies = calculateDependencyTree(package.dependencies);
  let devDependencies = calculateDependencyTree(package.devDependencies);
  return devDependencies - dependencies;
}

Ideally, this implementation does not depend on npm proper, because there have been at least two feature requests to be able to use alternative package managers.

@malept malept changed the title Packager should automatically ignore devDependencies Automatically ignore devDependencies Dec 31, 2016
@malept malept changed the title Automatically ignore devDependencies Do not copy devDependencies into the packaged app, prior to the prune step Aug 6, 2017
@MarshallOfSound
Copy link
Member

This should be possible soon MarshallOfSound/pruner#1

@malept malept removed the help wanted Needs a contributor from the community label Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request
Projects
None yet
Development

No branches or pull requests

3 participants