electron-builder does not copy directories named "node_modules" into my application
See original GitHub issueelectron-builder: >= 20.15.2 target: Windows, Mac OS, Linux
Hi everyone,
Since the new solution for copying node_modules (cf. https://github.com/electron-userland/electron-builder/releases/tag/v20.15.2), is not possible anymore to pass node_modules directory in electron package during build.
My electron app follows this structure:
├── dist_electron
| ├── electron-main
| ├── electron-renderer
| └── webapp-bundle
| ├── dist
| └── node_modules
|
├── index.js
├── package.json
My electron-builder config:
config = {
appId: `AppName`,
directories: {
output: 'dist_electron/electron-binaries',
buildResources: 'src/electron/resources'
},
asar: true,
files: [
'index.js',
'dist_electron',
'!dist_electron/electron-binaries'
'!node_modules',
'package.json',
]
...
}
I don’t need to electron-builder copies node_modules from my package.json dependencies.
My bundles are compile with webpack and for my webapp-bundle I need to add a node_modules directory with uncompilable modules.
Before electron-builder 20.15.2 it’s was possible to copy directories named “node_modules”.
So my question is: How can I copy children directories named ‘node_modules’ into my application? I don’t find any option or other informations.
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
It worked for me to add this to package.json:
“build”: { “includeSubNodeModules”: true }
I guess you guys are all talking about this annoying feature:
Pretty annoying! I want Electron-builder to only add the entries in
files
. It seems like Vue’s electron-builder plugin’s solution is to copypackage.json
into yourdist
directory, and then run electron-builder there (or pass the--app
command line option I guess). Then there is nonode_modules
directory to copy.Right but Webpack does more than just bundling Javascript. It can process images, compile Typescript, add mocks, minify Javascript, etc.