-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Is there a way to remove first "/" from resources url? #1094
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
We don't currently support this, the main reason being it's a footgun for apps with client-side routing. For example, people visiting However there are valid use cases such as if you don't use client-side routing, or if you build an Electron or Cordova app. We’ll need to address this in a future release. As a temporary hack I think you you should be able to set |
well, my problem was fixed when I edited two lines of code in webpack.config.prod.js: But I am sure this is not a solution. What if we look for an "environment" option in "package.json"? If required developers can specify whether it's for web or another framework like electron? |
@thevishnupradeep This works as a temporary fix but if I recall correctly it breaks other things. I’m not sure which approach exactly we will take, so I’m keeping it open. |
@gaearon @thevishnupradeep I would love your thoughts on this as a possible solution: Here is what I have for my
With this change:
|
@license2e @gaearon That works! didn't add child_process part. Just |
@thevishnupradeep I am having exactly the same issue with an electron app at the moment. Adding |
If you have a suggestion for how to avoid this problem but support client-side routing I’d love to know it. It’s not obvious to me. |
FWIW I use ./ as the homepage for Cordova apps and have my CSS resources (fonts, etc.) stored in /public and referenced in index.html using %PUBLIC_URL%. Works perfectly. I then create a symbolic link from build -> www and Cordova is happy. I'll do pretty much anything to avoid ejecting! |
Another possible workaround for now is to write a post-build step that replaces |
Now looking too on getting this set up work with react-router apps. |
So I'm also trying to use CRA with Cordova and I just messed around with this, and react-router can work if you use hashHistory rather than browserHistory. (I also implemented the homepage: ./ as well when I tested it). *Unfortunately I need to use a login redirect which receives an access token, and they do not accept fragments (#) as the redirect url..... Although there may be other interesting solutions to this here: remix-run/react-router#2161 |
Hi there! This should address majority of concerns, but this issue will remain open as it is for a broader topic (doing so while keeping client side routing). |
I'd like to close this since the original discussion is no longer relevant ( |
I know this is closed, but: After coming back to this and using |
The solution that I found it was in path config/path.js I only changed |
I am trying to build an electron app. I am simply pointing electron api to the build folder. But the issue is I am getting the error failed to load
file:///....
error. If I understand correctly, this is because of the extra slash at the beginning of the resource links.I just want to change links in html and other files from
"/static/js/main.2a85c832.js"
to"static/js/main.2a85c832.js"
?Could anyone help? Thanks
The text was updated successfully, but these errors were encountered: