You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm trying to use svelte/register in node.js for ssr, however components with scss or other preprocess features can't be used because preprocess is not called inside of register and result is an error.
It would be also useful for plain compile function, currently you have to pass your code twice, first to preprocess and then to compile. This addition will change this so you pass code only once to compile with an option.
Describe the solution you'd like
I'd like to have a preprocess option in compile function. This will also automatically add it to svelte/register.
Describe alternatives you've considered
I tried svelte/register and plain compile function, register gives error with preprocess features and compile gives errors with require. Bundling with rollup and then executing seems like the only alternative now.
How important is this feature to you?
I'm trying to make a plugin for generating ssr without the need to bundle app with rollup. Since it kinda works with bundling now, I can make it work and change when this feature is added. So the importance is low.
Additional context
Nope.
The text was updated successfully, but these errors were encountered:
svelte.compile is synchronous and svelte.preprocess is asynchronous (to allow for reading other files, or for async third-party libraries). require() is synchronous, and so the require hooks created by svelte/register also need to be synchronous. Adding a preprocess option to svelte.compile would cause it to become async (which we don't want to do), but also wouldn't work with svelte/register anyway. If you know that the particular preprocessing you're going to be doing is actually synchronous, your best bet is probably to write your own version of svelte/register that manually preprocesses the components before passing them on to the compiler - but this seems too niche and too restrictive for us to implement it in the official require hook.
Is your feature request related to a problem? Please describe.
I'm trying to use
svelte/register
in node.js for ssr, however components withscss
or other preprocess features can't be used becausepreprocess
is not called inside ofregister
and result is an error.It would be also useful for plain
compile
function, currently you have to pass your code twice, first topreprocess
and then tocompile
. This addition will change this so you pass code only once tocompile
with an option.Describe the solution you'd like
I'd like to have a
preprocess
option incompile
function. This will also automatically add it tosvelte/register
.Describe alternatives you've considered
I tried
svelte/register
and plaincompile
function,register
gives error with preprocess features andcompile
gives errors withrequire
. Bundling with rollup and then executing seems like the only alternative now.How important is this feature to you?
I'm trying to make a plugin for generating ssr without the need to bundle app with rollup. Since it kinda works with bundling now, I can make it work and change when this feature is added. So the importance is
low
.Additional context
Nope.
The text was updated successfully, but these errors were encountered: