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

Specify Vite mode in svelte-kit build #4584

Closed
edenworky opened this issue Apr 10, 2022 · 2 comments
Closed

Specify Vite mode in svelte-kit build #4584

edenworky opened this issue Apr 10, 2022 · 2 comments

Comments

@edenworky
Copy link

Describe the problem

I want to be able to set build mode. In Vite you can do vite build --mode some-mode, but this can currently only be set in svelte.config.js.

Describe the proposed solution

Support svelte-kit build --mode some-mode

Alternatives considered

Have a separate svelte.config.js just for the tests, but I can't find a way to point svelte-kit build to it

Importance

i cannot use SvelteKit without it

Additional Information

This makes testing very difficult since there's no simple way to detect that the app is running in test env

@jasonlyu123
Copy link
Member

Alternatively, you can use an environmental variable like VITE_MODE=some-mode svelte-kit build(or cross-env VITE_MODE=some-mode svelte-kit build to cover windows). And use it in svelte.config.js:

export default {
  kit: {
    vite: {
      mode: process.env.VITE_MODE
    }
  }
}

@bluwy
Copy link
Member

bluwy commented Apr 10, 2022

Duplicate of #1258

@bluwy bluwy marked this as a duplicate of #1258 Apr 10, 2022
@bluwy bluwy closed this as completed Apr 10, 2022
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

No branches or pull requests

3 participants