electron-superkit icon indicating copy to clipboard operation
electron-superkit copied to clipboard

Superkit works like a charm in dev, but not when compiled

Open akovalyov opened this issue 10 years ago • 4 comments

Thank you @Aluxian for great kit. Works like a charm in dev. However, when it is packed to production-ready package and it is installed, the following exception is thrown:

A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: content.charCodeAt is not a function

```     at stripBOM (module.js:442:15)
    at Object.Module._extensions..js (module.js:452:19)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/var/www/github/aluxian/electron-superkit/dist/opt/superkit/resources/app.asar/node_modules/babel-runtime/node_modules/core-js/library/fn/promise.js:1:80)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)

I assume, that it is somehow related to .asar packaging, because if I comment https://github.com/Aluxian/electron-superkit/blob/master/tasks/pack.coffee#L103-L109, the app is compiled and works correctly on Linux and Mac. Thanks in advance.

akovalyov avatar Oct 18 '15 17:10 akovalyov

That looks... tricky. Try to update babel. You could disable asar packaging, but on Windows your app might not work due to the 255 path length limit.

aluxian avatar Oct 18 '15 17:10 aluxian

I had the same issue, seems to be an issue with Asar+Babel. I ended up just ripping out Babel and moving over to Rollup. Works better with asar.

chrisesler avatar Oct 22 '15 18:10 chrisesler

Upgrade to Babel 6 + {"presets": ["stage-0", "es2015"]} works with asar. @Aluxian I can submit a PR to fix it, but I'd wait until babel6 is more stable and tested.

akovalyov avatar Nov 09 '15 00:11 akovalyov

Cool, then! I'd like to keep this open so I don't forget about upgrading it.

aluxian avatar Nov 09 '15 05:11 aluxian