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
Better solution for electron <base> url (or just document it) #639
Comments
I think I had the same issue. Please check your If you have a
change it to
because you serve the files from a file system instead of a domain path. It would be nice if |
Given that this is just how you need to configure Angular and other HTML5 routing systems, I think we just need to improve our documentation, along with seeing what's up with those asset urls not working |
I cannot load JS and CSS dependencies in a brand new Capacitor + Electron project which I setup yesterday, using Create React App V3 + TypeScript. I changed to Filepaths compute to My |
@basher, I have no experience with React, but you usually have to configure the base href in a config file before building so it changes all references before building instead of you changing manually the index.html. |
@jcesarmobile Thanks for your quick response. My bad... Anyway, I've just re-installed electron again, and still the same problem. Btw, I'm already familiar with using React + Electron. |
Further to my last comment, I've now updated {
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": "/index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
} I then build my CRA with However, I'm still getting the same error with CSS/JS filepaths computing to Does anyone in the Capacitor team have experience of creating an Electron app using Create React App? |
UPDATE: I now have working static paths to my JS/CSS etc in CRA + Capacitor + Electron. Having scoured the CRA repo for static asset bugs & fixes, this is the solution that works for me:
|
Updating the base href in |
The idea is to not do it manually, but when you build the www folder, angular allows to do it by adding |
Gotcha. Is adding the build command parameter recommended or is editing |
I'm on macOS 10.14.4, and my electron just didn't build out of the box until I found the thread indicating to add the I have installed |
the problem with loading the assets still here, anyone had a work around for it? |
found a workaround on ionic capacitor electron build, instead of "../assets/filename" or "/assets/filename", I used this one "assets/filename". But this gives me a heck of editing with other platforms, I hope capacitor will have a fix on this one. |
@basher 's solution #639 (comment) worked for me (homepage in root package.json) |
I´m trying to get this stack working for a week, with no luck... I´ve follow a lot of issues related to similar errors but again, with no luck... does someone has an example running with this stack that can share with all of us? |
@andonivianez after you change |
I´ve tested every proposed solution, but any of them works. I´ve tryed from a blank project, and it doesn´t work. Give it a try ;) |
For React, the
I also have made several edits to the Finally, I still haven't found where the error So at this point (at least for Win10), everything looks good and electron builder works. So for now, I'm inclined to ignore the splash property error. HTH! |
@mandolyte could you please give us more detail on your solution, I am facing the same issue |
@iliesaya First, I should note that I'm starting with React, not Ionic or Vue, or etc. Second, you are welcome to examine my solution here. So I'm taking an existing React Web app and making it into a standalone Electron app. There are two things you will find useful.
So now to answer your question specifically. I found that the
This is how it looks in the
So when I did the Important! note that after the npx command, the index file is in the The script and workflow file have a number of things I ended up doing to make this work to my satisfaction. You may or may not want to do them as well. |
Note: For launch the app with electron, follow these steps:(forgive my English I am native french speaker)
|
This is fixed in the next version of the capacitor platform for electron Changing the base-href stuff will no longer be required. Electron will be community supported going forward. |
@IT-MikeS in which version was it fixed? I just created an Ionic project, but electron app won't start correctly until I modify base-href. ( |
In the community version |
Hi,
I am trying to get my app running with Electron but no luck. When building this for iOS the iOS Simulator can start the app without problems.
For some reason it cannot load the
app.js
andapp.css
. I use thedist
dir and configured this in mycapacitor.config.json
My
npm run build
andnpx cap copy
commands run fine without any errors. I use Fedora 26, if that matters ;-)Any idea?
Thanks!
The text was updated successfully, but these errors were encountered: