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

Request: add debug log warning if preserveSymlinks is set to true in vite config #12597

Open
fnimick opened this issue Aug 20, 2024 · 0 comments
Labels

Comments

@fnimick
Copy link
Contributor

fnimick commented Aug 20, 2024

Describe the problem

When preserveSymlinks is set to true, depending on the resolved node_modules layout, you can end up with sveltekit classes constructed from client code using one symlink that are then handled by the server process running from a separate symlink. This means that instanceof checks fail and internals for handling of error(), redirect() etc all return generic error messages. For a related issue, see: #12139

Supporting running under preserveSymlinks I assume is difficult since the vanilla js operations for determining identity no longer work, but we could at least add a warning in the debug log for this case. I spent multiple hours trying to figure out why my redirects were no longer working, only to realize that resolved symlinks from a previous package update resulted in this issue appearing in my project.

From logging I put inside sveltekit's render_page, with a redirect thrown from a load function:

err: Redirect { status: 307, location: '/' }
err instanceof Redirect: false
err.constructor.name: Redirect

Describe the proposed solution

Vite config handling in https://github.com/sveltejs/kit/blob/main/packages/kit/src/exports/vite/index.js already outputs to the log if there are options set that are overridden by sveltekit. It would be great to have a warning output if preserveSymlinks is set to true to indicate that some sveltekit internal operations such as handling of throwables for http responses may not work in this situation.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

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

No branches or pull requests

2 participants