Closed nairod closed 7 years ago
Did you make sure, that the dependency you are requiring is listed in the dependencies
section of your package.json
? The app packager optimized the package, by only including these dependencies into the package.
yes it is included in package.json
I thought it helps to require the recursive-readdir-sync in entry.js but it didn't work.
now I think I found the reason. If I remove the --ignore=node_modules
flag for the packager, it works.
Oh yes, I forgot about this.
Could you please try to require your module with require
instead of the remote.require
function and then bundle it with the ignore
flag?
Ok, thanks for this. It works. This is the better solution as the package size is decreased by 50%.
Hi DevWurm First of all, thanks for sharing your knowledge. I'm creating a little inventory software to learn something about web development. Currently my app using your seed works fine as far as I'm in the development mode (yarn run start) but if I try it from the packaged executables I'm getting the following error. Do you have any clue why I can't use remote.require('recursive-readdir-sync')? Thanks in advance Dorian
AppComponent.html:13 ERROR Error: Cannot find module 'recursive-readdir-sync' Error: Cannot find module 'recursive-readdir-sync' at Module._resolveFilename (module.js:470:15) at Function.Module._resolveFilename (/home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/electron.asar/common/reset-search-paths.js:35:12) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at EventEmitter.<anonymous> (/home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/electron.asar/browser/rpc-server.js:263:70) at emitTwo (events.js:106:13) at EventEmitter.emit (events.js:194:7) at WebContents.<anonymous> (/home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/electron.asar/browser/api/web-contents.js:256:13) at emitTwo (events.js:106:13) at WebContents.emit (events.js:194:7) at Module._resolveFilename (module.js:470:15) at Function.Module._resolveFilename (/home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/electron.asar/common/reset-search-paths.js:35:12) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at EventEmitter.<anonymous> (/home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/electron.asar/browser/rpc-server.js:263:70) at emitTwo (events.js:106:13) at EventEmitter.emit (events.js:194:7) at WebContents.<anonymous> (/home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/electron.asar/browser/api/web-contents.js:256:13) at emitTwo (events.js:106:13) at WebContents.emit (events.js:194:7) at metaToValue (/home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/electron.asar/renderer/api/remote.js:234:13) at Object.exports.require (/home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/electron.asar/renderer/api/remote.js:309:10) at InventarService.webpackJsonp.169.InventarService.loadPhotos (file:///home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/app/dist/main.bundle.js:128:62) at AppComponent.webpackJsonp.176.AppComponent.loadPhotos (file:///home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/app/dist/main.bundle.js:240:31) at Object.eval [as handleEvent] (ng:///AppModule/AppComponent.ngfactory.js:500:24) at handleEvent (file:///home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/app/dist/vendor.bundle.js:12913:138) at callWithDebugContext (file:///home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/app/dist/vendor.bundle.js:14121:42) at Object.debugHandleEvent [as handleEvent] (file:///home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/app/dist/vendor.bundle.js:13709:12) at dispatchEvent (file:///home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/app/dist/vendor.bundle.js:9888:21) at file:///home/dorian/Dev/Workspaces/inventar-webpack-ng2cli/packages/inventar-glanzvoll-1.0.0-linux-x64/resources/app/dist/vendor.bundle.js:10478:38