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.

The builded .html files doesnt visualize correctly because href slashing

See original GitHub issue

Describe the bug

When the build is runned to make an static site, it make links in html files with a previous slash /

For example:

<link rel="modulepreload" href="/_app/start-d800466a.js">

href="/ <-----

Then, navigators can`t visualize the html builded correctly because the relative route is not correct …

Reproduction

npm run build

See the code of the html in build folder

Logs

No response

System Info

npm run build

Severity

annoyance

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
JTorresConsultacommented, Feb 14, 2022

Excuse my bad english. I work on windows, VSC and Node.js 16.

I already know what a relative path is. Obvious

All the browsers that I have installed on my computer (chrome, firefox, brave…) do not correctly interpret the bar at the beginning. For browsers to display correctly the beginning of the path must be, or without init slash, or with ./ (dot slash)

<link rel='stylesheet' href='/build/bundle.css'> – not working

<link rel='stylesheet' href='build/bundle.css'> – works <link rel='stylesheet' href='./build/bundle.css'> – works

0reactions
AndreReynosoPerucommented, Apr 15, 2022

Excuse my bad english. I work on windows, VSC and Node.js 16.

I already know what a relative path is. Obvious

All the browsers that I have installed on my computer (chrome, firefox, brave…) do not correctly interpret the bar at the beginning. For browsers to display correctly the beginning of the path must be, or without init slash, or with ./ (dot slash)

<link rel='stylesheet' href='/build/bundle.css'> – not working

<link rel='stylesheet' href='build/bundle.css'> – works <link rel='stylesheet' href='./build/bundle.css'> – works

Hi bro, can you solve this problem in svelte, no sveltekit, in the docs page from svelte I cannot see anything for config the “./” I have the same issue and I thought svelte does not work with php apache server in windows, I hope you can tell me an answer. PD. Sorry for my english

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why would a developer place a forward slash at the start of ...
It's done in order to root the path (making it an absolute path). It ensures that the path is not relative but read...
Read more >
HTML Suddenly formatting improperly · Issue #646 - GitHub
Prettier is suddenly formatting html in a strange way, adding closing slashes to <hr> elements, dropping brackets/carats to the next line, ...
Read more >
Dealing with files - Learn web development | MDN
Note: The Windows file system tends to use backslashes, not forward slashes, e.g. C:\Windows . This doesn't matter in HTML — even if...
Read more >
How to Fix a Broken Image on a Website [Guide]
When image html does not show up, or a picture won't display because it has not loaded, that's a broken image. Learn how...
Read more >
How To Build a Website with HTML | DigitalOcean
To check the results of this HTML code, we can load the “index.html” file in our browser. Though your file is not online,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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