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

Paths (base and assets) should be set to '' in svelte-kit preview #1154

Closed
Rich-Harris opened this issue Apr 20, 2021 · 4 comments
Closed

Paths (base and assets) should be set to '' in svelte-kit preview #1154

Rich-Harris opened this issue Apr 20, 2021 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@Rich-Harris
Copy link
Member

Rich-Harris commented Apr 20, 2021

Describe the bug
If you're using paths.base or paths.assets it's difficult/impossible to debug the production build locally. I would have thought that this...

app.init({
paths: {
base: '',
assets: '/.'
},
prerendering: false,
read: (file) => fs.readFileSync(join(config.kit.files.assets, file))
});
...would be sufficient, but it turns out I would have been wrong

To Reproduce
Add paths config to a project, then svelte-kit build && svelte-kit preview

Expected behavior
It should work (where 'work' means 'load JS and CSS')

Severity
Right now, extremely damn high

@Rich-Harris Rich-Harris added the bug Something isn't working label Apr 20, 2021
Rich-Harris added a commit that referenced this issue Apr 20, 2021
@benmccann benmccann changed the title Paths (base and assets) should be set to '' in svelte-kit start Paths (base and assets) should be set to '' in svelte-kit preview Apr 22, 2021
@benmccann benmccann added this to the 1.0 milestone Apr 22, 2021
@Rich-Harris Rich-Harris modified the milestones: 1.0, post-1.0 May 1, 2021
@sidharthv96
Copy link
Contributor

sidharthv96 commented May 31, 2021

I've been deploying https://sidharthv96.github.io/mermaid-live-editor/ using github pages. So a baseURL is necessary.
I had to use some crude hacks to debug an issue I had in production which I could not reproduce locally as base path was not used.
To keep both environments in sync, It would be better to honour basePath in local if it is set.
Adding this works for all pages except the root.

// base: `${this.config.kit.paths.base}/`,

So localhost:3000/mermaid-live-editor/edit would work, but localhost:3000/mermaid-live-editor/ would not.

@hperrin
Copy link

hperrin commented Aug 16, 2021

I'm hitting this issue recently too. At least I think it's the same issue. I'm seeing "_svelte_kit_assets" in the requests in npm run dev, but still getting a 404.

@hperrin
Copy link

hperrin commented Aug 16, 2021

Maybe I'm misunderstanding what "_svelte_kit_assets" is for. Am I supposed to provide that path myself?

thibaudpriou pushed a commit to thibaudpriou/paul-mathias-realisation.com-ssr that referenced this issue Sep 5, 2021
this does not yet work in dev env as described by Rich Harris here: sveltejs/kit#1154
thibaudpriou pushed a commit to thibaudpriou/paul-mathias-realisation.com-ssr that referenced this issue Dec 21, 2021
this does not yet work in dev env as described by Rich Harris here: sveltejs/kit#1154
thibaudpriou added a commit to thibaudpriou/paul-mathias-realisation.com-ssr that referenced this issue Dec 21, 2021
this does not yet work in dev env as described by Rich Harris here: sveltejs/kit#1154
@Rich-Harris
Copy link
Member Author

closing this as out of date — base and assets (replaced with _svelte_kit_assets) are now used in dev and preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants