Skip to content
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

generated start file does not work with relative path #1480

Closed
wighawag opened this issue May 17, 2021 · 1 comment
Closed

generated start file does not work with relative path #1480

wighawag opened this issue May 17, 2021 · 1 comment

Comments

@wighawag
Copy link
Contributor

I could not find where in the source code the generated start file is coded, but in my ipfs app, I need to get rid of all absolute path

The start file generated by sveltekit inject script tag at run time and is given a list of paths for that. Unfortunately these paths do not have access to the router base property currently,

Note that my ipfs adapter ensure the router base path is generated at runtime (See comment here: #595 (comment) ) so the solution will also have to operate at runtime.

Could we make so that the start file have access to the router base property ?

in the generated start file I see something like this :

        if (document.querySelector(`link[href="${t}"]${r}`))
            return;
        const s = document.createElement("link");
        ...
        s.href = t,
        document.head.appendChild(s),
  

by default t is an aboslute path. I hacked the output of static adapter via a postprocess and I make sure that the various t path are relative

Unfortunately depending on the context (the value of window.location), the relative path will be interpreted differently
The solution would be ensure the t paths are generated with the router.base in mind so that script tag are given only absolute path, making them independent of context

@Rich-Harris
Copy link
Member

Closing in favour of #595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants