"Cannot find module" after Electron build.
mvbn opened this issue · 3 comments
Your library is great. But there is an issue, when I start the app compiled with Electron, I have an error message. I had a similar problem with others libraries like JSZip, js-xlsx, etc, but I found the way to use them also on Electron builds, unfortunately I wasn't lucky with jschardet.
Please can you have a look? Thanks!
Here attached a sample minimal project (to reproduce the problem):
sample-ko-with-electron-packager.zip
Uncaught Exception:
Error: Cannot find module './src'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (/Users/dev/Desktop/App/releases/App-darwin-x64/App.app/Contents/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 require (internal/module.js:20:19)
at Object. (/Users/dev/Desktop/App/releases/App-darwin-x64/App.app/Contents/Resources/app/node_modules/jschardet/index.js:1:173)
at Object. (/Users/dev/Desktop/App/releases/App-darwin-x64/App.app/Contents/Resources/app/node_modules/jschardet/index.js:2:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
Using electron-builder instead of electron-packager, it works! ;)
@mvbn I'm happy you were able to find the solution! Would you like to write a blog post or something about it that I can link to? Thank you.
PS: funny that you bring JSZip up, it's built by a friend of mine :)
@aadsm I attach here the "electron-builder" sample version (some info on the "readme.md" file). I didn't follow special operations to have the library working, it just properly work if builded with electron-builder instead of electron-packager. Thanks for your great library!
sample-ok-with-electron-builder.zip
PS: Ahah, it's a small world. ;)