-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support multiple compiler & preprocess options #773
Comments
I think these are are all solvable without changing the design:
Preprocessors typically target specific languages, identified with
Libraries shouldn't require preprocessing, they should be distributed in a ready-to-use state.
This is perhaps a little trickier. I'd definitely push back on 'it's not uncommon' :) but this is possibly a case where you could create a separate library of WCs and import them after they've been built: <script>
import '@me/my-wcs/my-widget'
</script>
<my-widget answer={42}/> |
All these are helpful. I'll see how far I can get with some of them. They're just sometimes a bit inconvenient.
I suppose it's straight forward to write a preprocessor for such use cases, but with the added inconvenience of separately maintaining some functionality included out of the box in
Suppose I have TypeScript or Sass in my library, and I don't expect downstream users to have TS or Sass in their setup, is there a canonical way to preprocess, but not compile svelte components for distribution? The alternative is to say that libraries simply can't use any preprocessing or non-default compiler settings. What about a situation when the user's components have preprocessing that they don't want to affect library's "non-preprocessing"? It goes back to the above
Again, this is workable, but the ergonomics of separate build steps is not ideal if it can be avoided. |
Unfortunately not yet. There are some related discussions in the componente-template (1, 2, 3). |
I'm not sure I understand —
There will be! It will be a part of SvelteKit (the component-template repo will almost certainly be archived). In the meantime it's possible to do it yourself just by using the preprocess API manually. |
vite-plugin-svelte supports the same include/exclude options as rollup-plugin-svelte https://github.com/sveltejs/vite-plugin-svelte/blob/b229a8c412db713663021cf9d20bb179f0d42cbd/packages/vite-plugin-svelte/src/utils/options.ts#L140. If you pass preprocessors as inline options you should be able to recreate the rollup config in the original post. |
It sounds to me like this was addressed by dominikg's comment, so I'm going to go ahead and close this |
This is a reiteration of sveltejs/language-tools#410 but in the context of svelte-kit.
Is your feature request related to a problem? Please describe.
Currently, the svelte.config.js assumes one config for your entire directory. However, it's not uncommon to want to compile some components to web component and others to vanilla Svelte. Some components may need one CSS, Markdown, Language (TS)...etc. preprocess and others another one, especially when using an external Svelte library.
Describe the solution you'd like
When using Rollup, I solve this using the
exclude
/include
options and multiple instances of the Svelte plugin. (Not very elegant)My current suggestion is to accept an array of
compilerOptions
andpreprocessOptions
.Describe alternatives you've considered
I haven't found an alternative in the context of the svelte-kit. Suggestion for workarounds are welcome.
How important is this feature to you?
This is critical to different projects I work on, (particularly those using some web components and an external Svelte component library). It's a blocker to migrating from Rollup.
Additional context
The solution implementation for this issue would be far-reaching. It may need some consensus from several Svelte tools using
svelte.config.cjs
.The text was updated successfully, but these errors were encountered: