Skip to content

Netlify Adapter 404 assets when kit.paths.base is defined #4442

@asendia

Description

@asendia

Describe the bug

As titled, when kit.paths.base is defined, the asset requests (js, css, etc) get 404 from /[kit.paths.base]/_app. The actual assets are still accessible from /_app.

In local env, npm run preview can correctly load assets from /[kit.paths.base]/_app.

Reproduction

I have modified the svelte.config.js in this stackblitz link. Run npm run build and you will get the 404 error.

Logs

No response

System Info

System:
    OS: macOS 12.3
    CPU: (8) arm64 Apple M1
    Memory: 277.94 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 99.0.4844.83
    Firefox: 92.0.1
    Safari: 15.4
  npmPackages:
    @sveltejs/adapter-netlify: next => 1.0.0-next.51 
    @sveltejs/kit: next => 1.0.0-next.301 
    @sveltejs/svelte-virtual-list: ^3.0.1 => 3.0.1 
    svelte: ^3.44.0 => 3.46.4

Severity

serious, but I can work around it

Additional Information

I execute this workaround script in postbuild, assuming kit.paths.base = 'test':

# Move assets to base dir
mv build/_app build/test/_app
# Update default netlify headers
sed -i '' "s/_app/test\/_app/g" build/_headers

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.paths.basebugs relating to `config.kit.paths.base`

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions