question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to remove first "/" from resources url?

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
mcmundercommented, Jun 9, 2017

I know this is closed, but:

After coming back to this and using react-router-dom’s HashRouter in addition to the "homepage" : "./" trick, client side routing just works in my recent electron app. I’ve created this barebones electron-create-react-app boilerplate, just in case someone stumbles upon this and wants to have a look…

4reactions
luojxxxcommented, Jan 12, 2017

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: https://github.com/ReactTraining/react-router/issues/2161

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove the first slash in my URL with JavaScript
Different way. var rawurl = "/option=com_content&view=article&id=2&Itemid=2";. rawurl = rawurl.substr(rawurl.indexOf('/') + 1);.
Read more >
How do I remove trailing slashes from a URL when using ...
You could always use mod_rewrite to redirect the directory name without the trailing slash to dirname/index.html . You could use RedirectConds to make...
Read more >
URL Canonicalization and the Canonical Tag | Documentation
When a site has duplicate content, Google chooses the canonical URL. Learn more about canonical URLs and how to consolidate duplicate URLs.
Read more >
Express Tutorial Part 4: Routes and controllers - MDN Web Docs
In this tutorial we'll set up routes (URL handling code) with "dummy" ... The first argument to this method is the URL path...
Read more >
RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, ... A URI may be represented in a variety of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found