Skip to content

1.0.0-next.306 broke Vite's preserveSymlinks #4936

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

Closed
mikenikles opened this issue May 16, 2022 · 1 comment · Fixed by #4957
Closed

1.0.0-next.306 broke Vite's preserveSymlinks #4936

mikenikles opened this issue May 16, 2022 · 1 comment · Fixed by #4957
Labels
bug Something isn't working
Milestone

Comments

@mikenikles
Copy link
Contributor

Describe the bug

Vite provides a resolve.preserveSymlinks option (docs). This used to work until SvelteKit 1.0.0-next.305, but no longer works in 1.0.0-next.306 where it throws a 404 Page Not Found error.

Reproduction

Stackblitz does not support symlinks, hence a link to a GitHub repo.

https://github.com/mikenikles/sveltekit-symlinks

Logs

404
Not found: /docs
Error: Not found: /docs
    at resolve (file:///workspace/sveltekit-symlinks/.svelte-kit/runtime/server/index.js:2797:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async respond (file:///workspace/sveltekit-symlinks/.svelte-kit/runtime/server/index.js:2690:20)
    at async file:///workspace/sveltekit-symlinks/node_modules/@sveltejs/kit/dist/chunks/index.js:295:24

System Info

System:
    OS: Linux 5.16 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (16) x64 AMD EPYC 7B13
    Memory: 33.21 GB / 62.80 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.42 
    @sveltejs/kit: 1.0.0-next.306 => 1.0.0-next.306 
    svelte: ^3.44.0 => 3.48.0

Severity

blocking an upgrade

Additional Information

Start SvelteKit with npm run dev and navigate to http://localhost:3000/docs to see the error.

@mikenikles
Copy link
Contributor Author

Found the issue.

At https://github.com/sveltejs/kit/blob/master/packages/kit/src/core/sync/create_manifest_data/index.js#L447, we need the following:

-if (file.isDirectory()) {
+if (file.isDirectory() || file.isSymolicLink()) {
  list_files(`${dir}/${file.name}`, joined, files);
} else {
  files.push(joined);
}

I'll look into opening a PR for it.

@Rich-Harris Rich-Harris added the bug Something isn't working label May 16, 2022
@Rich-Harris Rich-Harris added this to the 1.0 milestone May 16, 2022
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

Successfully merging a pull request may close this issue.

2 participants