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

svelte-kit preview ignores port and host in svelte.config.js #5335

Closed
keithlayne opened this issue Jul 1, 2022 · 1 comment · Fixed by #5332
Closed

svelte-kit preview ignores port and host in svelte.config.js #5335

keithlayne opened this issue Jul 1, 2022 · 1 comment · Fixed by #5332

Comments

@keithlayne
Copy link

keithlayne commented Jul 1, 2022

Describe the bug

Looking at https://github.com/sveltejs/kit/blob/master/packages/kit/src/cli.js#L167-L187 you can see from inspection that these two config entries will always be overwritten because the options are defaulted. svelte-kit dev doesn't share this problem because these options are not defaulted.

Reproduction

  1. Create a new sveltekit project via npm create svelte foobar
  2. Edit svelte.config.js and set config.kit.vite.preview.port to 3001
  3. Run e.g. npm run preview

Logs

Output: 


  SvelteKit v1.0.0-next.357

  local:   http://localhost:3000
  network: not exposed

  Use --host to expose server to other devices on this network

System Info

System:
    OS: Linux 5.17 Pop!_OS 22.04 LTS
    CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics
    Memory: 1.02 GB / 15.02 GB
    Container: Yes
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.asdf/installs/nodejs/16.13.1/bin/node
    Yarn: 3.2.1 - ~/.asdf/shims/yarn
    npm: 8.1.2 - ~/.asdf/plugins/nodejs/shims/npm
    Watchman: 4.9.0 - /usr/bin/watchman
  Browsers:
    Chrome: 103.0.5060.53
    Firefox: 101.0.1
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.53 
    @sveltejs/adapter-static: ^1.0.0-next.34 => 1.0.0-next.34 
    @sveltejs/kit: next => 1.0.0-next.357 
    svelte: ^3.44.0 => 3.48.0 

Severity

annoyance

Additional Information

This is a mild annoyance but a trivial fix. The only reason this isn't a PR is because I don't see any obvious way to put tests around this. If you don't care, or can point me in the right direction, I'll send a PR.

I also saw the suggestion to stop using svelte-kit preview in favor of vite preview which looks like it would make this issue moot.

@keithlayne
Copy link
Author

Looks like I've duped #5312 somewhat.

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

Successfully merging a pull request may close this issue.

1 participant