Closed khanetor closed 8 years ago
If/when this is implemented, it would need to be compatible with earlier versions of npm (i.e., the 2.x series).
You can try installing the latest npm. I did it accidentally by running npm update -g
. Then you can try npm install
with your package.json.
On Sep 29, 2015, at 11:20 PM, Mark Lee notifications@github.com wrote:
If/when this is implemented, it would need to be compatible with earlier versions of npm (i.e., the 2.x series).
— Reply to this email directly or view it on GitHub https://github.com/maxogden/electron-packager/issues/145#issuecomment-144109496.
Not sure what you're saying here. Are you advocating that we require users to install npm >= 3.0?
I don't know why you mention the "compatible with earlier versions of npm".
Everything still works fine with npm 3. The difference is that let's say you have 30 items in your dependencies and devDependencies in your package.json file. What you will find in your _nodemodules directory is not 30 npm modules, but rather about 530 modules. With NPM 3, they flat out the dependencies instead of leaving them nested like before. Check this article, and this one, and look for the keyword "flat".
With this flat structure, I would have to figure out the modules only used for development, which was not only those listed under devDependencies, to add them to the --ignore
flag.
So I am saying that it would be nice if electron-packager can figure out all the packages under devDependencies recursively and ignore them. This would also help with using NPM 2, where I no longer have to use --ignore
flag often (for webpack and loaders).
Lastly, I am not advocating the use of npm >= 3.0. I would not use it as of now because figuring out all the modules to put under --ignore
is a nightmare. However, there are readings that say NPM 2 is still around as LTS, and it will be depreciated.
I just wanted to make sure that if this is implemented, electron-packager still works with npm 2.x.
a simple workaround to avoid a complex solution is to put your app in a subfolder with its own package.json
For what it's worth the way the packaging of node modules currently works is quite problematic for larger apps. I ended up with so many issues that I just ended up using webpack for everything but native extension, then ignore the entire mode_modules
folder and copy over the few items that are native dependencies.
At present I can't even get my built dylibs into the final artifact when not manually copying it over (not sure why).
So what I want to propose is to make electron-packager aware of node a bit and understand how the modules work and the non-dev dependencies over.
I also had this problem and solved this problem with maxogden's way. I think that maxogden's idea is best approach to solve this problem.
This request the same as either #198 or #235, depending on how you look at it.
With npm 3, all depenciea are in root directory of node_modules. So I had to figure out which dependencies are only for devto ignore. I think a nice feature to have is the packager only copy over the npm modules listed under dependencies and not devDependencies, recursively.