-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Is it possible to target electron-renderer? #1738
Comments
A little side advice since i wrote multiple electron apps with building tools in the past, you don't really need to build the main process files, electron understands ES6 and the new 3.0.0 beta can also use the import syntax ;) |
Hi @Hammster, thanks for the quick reply! To explain what I am doing. maybe it is not the way it should be done? I have an the Is this the way intended? or did I miss something? |
Feel free to contact me on the parcel slack, by mail, via twitter (@hammster1911) or the new parcel spectrum channel, if you need further help, since this issue is not really parcel related ;) |
index.electron.js is imported in a index.electron.html, it is in the renderer process. I just sent you a DM on twitter. Thanks |
Hi @Hammster, just to verify and double-check with you:
Correct? That would mean, this boilerplate for example is doing it wrong? If that is true, perhaps we could make that more explicitly clear in the api docs? Many people appear to run into a seeming import/fs issue, which (if I understand correctly) is related... |
@nocke that's correct, i'm going to quote some sourcecode for that. parcel/packages/core/parcel-bundler/test/utils.js Lines 170 to 183 in 0937705
As you can see the electron target prepares a browser context, therefore it is aimed for a render view. In addition to that loosened up from I would propose the following, to lower the risk of confusion
EDIT: I've tried the boilerplate, my guess is that something else is off, because the require actually is parsed correctly to the index.js of electron for further handling. And you can evaluate the require('fs') in the console after it. |
@Hammster are you sure I can use import syntax in the main process? I'm using Electron 4.0.1 and I get syntax error when I try to use import statement. How can I do that without building using parcel? |
@Hammster using
throws error: I've used to use the |
❔ Question
Hi, I am new to parcel, and I was wondering if there was a way to build with parcel and target for electron-renderer? I saw that there is a target electron, but it removed all the node_modules and then my app does not work anymore?
🔦 Context
I need build for electron-renderer/electron to be able to do:
I need access to this in my react app. Parcel worked perfectly to target the browser, but I can't completely switch to parcel until I can build both electron and web apps with it.
I saw that #1690, which looks like it might be the solution to my problem?
because now, when I build with target electron, I get react not found.
Thanks for your help
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: