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

Symlinking into routes folder not working #1460

Closed
Madd0g opened this issue May 15, 2021 · 1 comment
Closed

Symlinking into routes folder not working #1460

Madd0g opened this issue May 15, 2021 · 1 comment
Labels

Comments

@Madd0g
Copy link

Madd0g commented May 15, 2021

Describe the bug
I want to be able to develop some code that can be used by more than one website. So I want the contents of /routes to be populated with some real files but symlinked folders too.

I try to symlink a local folder into /routes/p and access a markdown file from that folder:

Logs
I get this error:
Cannot find module 'svelte/internal' from '<my-project>/src/routes/p'

To Reproduce
I'm using a symlink on mac to link a folder into /routes/p

ln -s ~/path/to/markdown/folder ./src/routes/p

I'm using a very simple mdsvex config

/** @type {import('@sveltejs/kit').Config} */
const config = {
	extensions: [".svelte", ...mdsvexConfig.extensions],
	// Consult https://github.com/sveltejs/svelte-preprocess
	// for more information about preprocessors
	preprocess: [
		preprocess({
			postcss: true,
		}),
		mdsvex(mdsvexConfig),

	],
	kit: {
		vite: {
                     ......

Expected behavior
There should be a way to configure preserveSymlinks. I dug into the vite code and it looks like this is hardcoded to false unless running from pnp or something?

If I hardcode it to true instead of false, my code works.

https://github.com/vitejs/vite/blob/8b5a6a855091e6f744cc7b886cf927d14dc74d50/packages/vite/src/node/utils.ts#L36-L49

Information about your SvelteKit Installation:

Diagnostics
  System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
    Memory: 31.20 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 16.0.0 - ~/.nvm/versions/node/v16.0.0/bin/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 7.10.0 - ~/.nvm/versions/node/v16.0.0/bin/npm
  npmPackages:
    @sveltejs/kit: 1.0.0-next.102 => 1.0.0-next.102
    svelte: ^3.34.0 => 3.38.2

Severity
I really want a way of putting .svelte/.css/.md files outside of /src to develop the implementation of the website separately from the content.

Additional context
I commented on mdsvex issues looking for an alternative solution to my problem.

@benmccann
Copy link
Member

Can you file this issue in the Vite repo instead? Since the code you're referring to lives there I think that's where the code change would be necessary and there's not much we can do in SvelteKit

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