Set relative path folder in Svelte build
When I build my svelte app with the command npm run build
, it's export the links like this:
<script type="module" crossorigin src="/assets/index-54c7d896.js"></script><link rel="stylesheet" href="/assets/index-d3d038e5.css">
More accurately it call to the root localhost/assets...
// src="/assets/index-54c7d896.js" // href="/assets/index-d3d038e5.css"
And I get this:
From here:
where I want use the svelte app
And easy solution is using a relative path to:
// from "/assets/..." to "./assets/..."src="./assets/index-54c7d896.js"href="./assets/index-d3d038e5.css"
But the thing is I can't do that inside javascript and css files.These still use an absolute path.
So this is what happens:
when a css file call other files using absolute path
I mean I could dig into a compiled file but it's not efficient
I tried change manually the paths on each file but it's a lot of work each time than I have to compile.
I'm using a hosting with php so I tried using .htaccess but it's hard too.