-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
electron-compile support #807
Comments
Why was this closed? I never got any response and the problems I had are still standing. |
@develar can you provide some guidance on what would be needed to get this working? |
@unindented I haven't yet investigate it. If you can provide error message — I can help you to fix it. |
Is there currently no way of using electron-builder together with tools such as electron-compile? Other issues mention that this is out of scope, but I'd still like to get this working. |
@arekkas Just compile it using babel — http://electron-builder.slackarchive.io/general/I%252520just%252520discovered%252520that%252520I/
|
@develar ok so your idea is to run babel on ps: seems like electron-compile passes the ball to electron-builder, see electron-userland/electron-compile#99 |
@arekkas Yes, as was reported by @pronebird.
We are going to support precompilation on our side soon. |
@arekkas not without limitations but we do a lot of awesome stuff with babel-cli alone in https://github.com/jschr/electron-react-redux-boilerplate/blob/master/package.json |
I see, thanks for pointing me at it. Thank you all for your work on this. At some point, it would probably be cool to have an overview of what to use when for what and how. For a newcomer to the electron ecosystem I have to say it's a steep learning curve :D |
Good news — electron-complie support mostly implemented and will be released in two days. Sorry that it was not implemented so long. |
@pronebird Am I right that es6 shim is not required — electron-userland/electron-compile#207 ? |
@develar it could be I did something wrong but I had exactly the same problem where this shim was used in production build. I switched to pure babel pre-compilation since then and never looked back. |
@pronebird Ok. Thanks for answer. I am waiting @paulcbetts response (electron-userland/electron-compile#207) but it seems shim is not required and electron-builder will not produce shim. BTW, is ability to provide own transformer for files will be useful for you? I mean — transpile file for production on the fly (electron-builder writes result of transpilation (electron-compile CompilerHost) directly to asar file without any intermediate/temp files). |
@develar either way I transpile files manually for development so I don't really see the benefit of delegating this to electron-builder. |
Supported in the 16.0.0 — if electron-compile in your dependencies, all files will be transpiled on the fly. Currently, only supported if asar enabled (feel free to file issue to support if asar is disabled).
|
Awesome! |
It would be good to know what I need to get this new feature to work. I have an app that is using "scripts": {
"build": "build"
},
"build": {
"productName": "NTS mini",
"mac": null,
"asar": true
}, when I build the artifact, they build correctly and I get no errors but when I attempt to open up the app.dmg, I get the following error Uncaught Exception:
Error: Cannot find module 'electron-compile' Also as a side-note the app is coming in pretty big, its a veery simple app and the bundle is around 125MB |
@samjbmason Is it possible to provide your project for test? |
@develar I have added you as a collaborator if that's ok? |
@samjbmason electron apps are generally over 100M due to the size of runtime/libraries used in them. They say there is no way to decrease the size. This would hold true for any native app as well if most of dependencies weren't shipped with operating systems. |
@pronebird Ah ok that's not a problem I just wanted to make sure and that it wasn't a symptom of the errors that I was receiving when trying to run the app |
@samjbmason Some errors discovered on your app, some on electron-builder side. I will post details later. Yes — electron-builder is not going to use easy way because our goal to help users, not just "well, we build something". |
@samjbmason
Error on electron-builder side fixed, please try 16.0.1 |
@develar Thanks very much for that!
|
You should use babel-plugin-transform-inline-imports-commonjs to transform imports to a lazy require statements. It will allow to use imports for any dep, but of course, usage should be only after check that app in the dev mode. Currently, you will get warn about electron-compile dep, but I will fix it later. https://www.npmjs.com/package/electron-is-dev Yes, electron-builder asks to move electron-compile to dev deps — it is correct. About shim — https://github.com/electron-userland/electron-prebuilt-compile |
Reopened as we have the answer — electron-userland/electron-compile#207 (comment) |
Any idea what's causing this?
|
@arekkas electron-buidler version? |
@develar 16.3.0 - also I'm using |
@arekkas If you can, please provide project to test (you can send me link privately using slack). |
@develar thanks for this, I'll try a couple more things and if I'm unable to figure it out I'll come back to that :) Just wanted to check if there's any additional wiring required for electron-compiler, but I guess this should work out of the box right? |
@arekkas Is file on disk is equals to extracted file To be sure, that it is electron-builder corrupts file (or not).
Yes. |
By the way, I'm not talking about the bundle here, but simply |
Is there a way to disable electron-compile integration? |
@arekkas Will be added today. Why do you want to disable? |
Will be released soon. |
Because for now I'm sticking with my babel flow, but I still need electron-compile for my e2e tests to work, so it's in the devDependencies which causes the package to crash with "electron-compile not found" after packaging |
Nice, thanks for the quick update! |
7.11.3
all
I've just integrated my app with
electron-prebuilt-compile
which compiles various assets and JavaScript using babel. According to https://github.com/electron/electron-compile#how-can-i-precompile-my-code-for-release-time it works withelectron-packager
. I tried just running the build, but nothing gets build with the default setup ofelectron-builder
.Is there a way to get this integration working?
You can see the code here: https://github.com/ipfs/station/tree/better-build
The text was updated successfully, but these errors were encountered: