packager
packager copied to clipboard
Does not include other node_modules packages in compiling
Preflight Checklist
- [x] I have read the contribution documentation for this project.
- [x] I agree to follow the code of conduct that this project follows, as appropriate.
- [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.
Issue Details
- Electron Packager Version: *15.4.0
- Electron Version: *16.0.4
-
Operating System:
- Microsoft Windows 10 Pro
-
Last Known Working Electron Packager version::
- None
Expected Behavior
It should be able to include node_modules packages in compiling Including express, discordnitro & other NPM packages.
Actual Behavior
After the compiling, run the compiled EXE file and It should return an error Cannot find module 'discordnitro'
To Reproduce
- Open CMD and type this command create-electron-app reproduce, Just an example.
- cd to the directory & install discordnitro. npm i discordnitro
- Import the discordnitro in the file.
- cd to src and build it. cd src && electron-packager ./ reproduce --platform=win32 --arch=x64
- Run the compiled EXE file and It should return an error Cannot find module 'discordnitro'.
Additional Information
None
👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
Hi @I2rys,
I got the same or similar problem. After research I found this change https://github.com/electron/electron-packager/pull/819 since then you have to take care of the pruned node_modules by yourself.
See also the readme "usage"
...Be careful not to include node_modules you don't want into your final app. If you put them in the devDependencies section of package.json, by default none of the modules related to those dependencies will be copied in the app bundles. (This behavior can be turned off with the prune: false API option or --no-prune CLI flag.) In addition, folders like .git and node_modules/.bin will be ignored by default. You can use --ignore to ignore files and folders via a regular expression (not a glob pattern). Examples include --ignore=.gitignore or --ignore=".git(ignore|modules)"...
an prune:false
worked for me