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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export vitePreprocess API #509

Merged
merged 22 commits into from
Dec 2, 2022
Merged

Export vitePreprocess API #509

merged 22 commits into from
Dec 2, 2022

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Nov 24, 2022

Export vitePreprocess() Svelte preprocessor from @sveltejs/vite-plugin-svelte. (Previously exported from /preprocess subpath but now root)

experimental.useVitePreprocess is deprecated.


Things I'm still thinking of, but could be a future problem:

  1. Should we deprecate useVitePreprocess?
  2. Following no1, there are frameworks like Astro that wants to preprocess with Vite by default. The user can get intellisense by adding vitePreprocess to svelte.config.js but that results in two same preprocessors running at the same time. Should we deduplicate them internally?
  3. When running in a Vite dev server that has it's own ResolvedConfig, do we want to share it to the style preprocessor? If the user passes an InlineConfig to the style preprocessor, it makes config merging not possible. Also it feels a bit magical 馃

EDIT: Answered:

  1. yes.
  2. Astro should deduplicate themselves.
  3. now implemented in this PR. When using the preprocessor in Vite dev server, the preprocessor will use that config.

@dominikg
Copy link
Member

yes to deprecate, the improvement in DX makes using the plugin option inferior. we can add docs how to migrate. it's experimental still so no semver constraints

docs/preprocess.md Outdated Show resolved Hide resolved
@benmccann
Copy link
Member

I'd be curious if there's been any rough benchmarking to see if this is faster. esbuild is obviously faster, but you'd also have to call out to another process which is slower (I think once per file), so I wonder if it's overall faster. If we can confirm it's faster, I wonder if this should be made the default in create-svelte?

docs/preprocess.md Outdated Show resolved Hide resolved
Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
docs/preprocess.md Outdated Show resolved Hide resolved
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
@dominikg dominikg merged commit 0971449 into main Dec 2, 2022
@dominikg dominikg deleted the preprocess-api branch December 2, 2022 16:29
@github-actions github-actions bot mentioned this pull request Dec 2, 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

Successfully merging this pull request may close these issues.

None yet

3 participants