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

Config paths.base and static folder don't play well together #3267

Closed
DblK opened this issue Jan 9, 2022 · 3 comments
Closed

Config paths.base and static folder don't play well together #3267

DblK opened this issue Jan 9, 2022 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@DblK
Copy link

DblK commented Jan 9, 2022

Describe the bug

When adding a path.base all the path marked with %svelte.assets% are replaced with the path as expected.
This works great with npm run build.
However during dev mode, the static folder still represent / instead of the value of path.base.

Reproduction

Add the following configuration:

kit: {
  ...,
  paths: {
    base: '/admin',
  },
}

And add <link rel="stylesheet" href="%svelte.assets%/myCSS.css" /> in app.html.
In your static folder have the following structure:

| static
  |- myCss.css

The css in dev mode won't work unless you manually create the same folder

| static
  |- admin
    |- myCss.css

I wish to stick the file myCss.css at the root of static folder and let the magic happens to serve those file as if under paths.base (in my example /admin/myCSS.css stored in static/myCSS.css

Logs

No response

System Info

System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
    Memory: 128.55 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
    npm: 7.24.0 - ~/.nvm/versions/node/v14.17.0/bin/npm
  Browsers:
    Chrome: 97.0.4692.71
    Firefox: 89.0.2
    Safari: 14.0.3
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.9 
    @sveltejs/adapter-static: ^1.0.0-next.24 => 1.0.0-next.24 
    @sveltejs/kit: ^1.0.0-next.218 => 1.0.0-next.218 
    svelte: ^3.45.0 => 3.45.0

Severity

serious, but I can work around it

Additional Information

I add the path in my config for building but removing during dev. This is pretty annoying.

@DblK
Copy link
Author

DblK commented Jan 9, 2022

After search seems to be close to #3232

@ebeloded
Copy link

I just came here to report this exact issue, but you already did it 👍

Issue #3232 description focuses on the static adapter, but the problem is the same for the node-adapter. Static assets location should respect paths.base.

@benmccann benmccann added this to the 1.0 milestone Jan 18, 2022
@benmccann benmccann added the bug Something isn't working label Jan 18, 2022
@benmccann
Copy link
Member

I think this should be fixed by #3346

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

3 participants