interview with svelte master
ux/dx, rollup, svelte routers, sapper, community, resources, future developments
Svelte Master is a youtube channel dedicated to all things Svelte and covers topics like why Svelte is the best JS framework, routing in Svelte, and other Svelte related projects like Sapper. In this interview we talk about everything going on in the ecosystem and where it’s headed.
AJC
You’ve called Svelte “the best framework yet.” That’s a bold claim. Lets here the reasoning.
SM
It comes down to 2 things:
Better UX (user experience)
Better DX (developer experience)
Better UX:
smaller bundle sizes (faster load)
no virtual DOM overhead (better performance)
Better DX:
less code to write (can code faster, happilier, less buggilier)
simpler concepts (same reasoning as above ^^^)
built-in state management, transition and reactivity, simpler forms with binding, components are valid HTML, context is simple, event dispatching, etc..
How can it do this??
Svelte is a compiler so it can add features without adding bloat to the framework.
Also, Svelte is its own language so it can do what it needs to keep things simple and intuitive, whereas React is a library and has to do some gymnastics to stay within the restraints of Javascript.
AJC
When I started learning Svelte it reminded me a lot of Vue in the way it separates your script (JavaScript), your styling (CSS), and your markup (HTML). Since I’m coming from a React background this took a little getting used to, but I would imagine Vue developers could ramp up extremely quickly. Do you think developers coming from different backgrounds have an easier or harder time picking up Svelte?
SM
If you’ve used a component-based framework then Svelte is SUPER intuitive. I’ve only used React and the main weirdness for me was the templating syntax rather than using .map
and JS if
-statements. But I like that part now. It’s definitely more similar to Vue than React.
AJC
Svelte comes with Rollup as its bundler by default instead of Webpack. I have a theory that if Svelte continues to rise in popularity this will have a second order effect on shifting the mindshare from Webpack to Rollup simply because developers don’t want to think about tooling and will go with whatever is the simplest default. Have you spent much time configuring Rollup and have you noticed many differences between Rollup and Webpack?
SM
Nooo, I avoid those and just copy-paste when I need to. My impression is that rollup is simpler and faster but I’d be on the lookout for Snowpack! Pretty speedy guy it seems…
(AJC: I definitely have Snowpack on my radar, will probably dedicate a post to it soon along with the whole Pika ecosystem)
AJC
There’s always been a big debate about whether frameworks should include their own router or bring in a third party library. For example:
Ember had a tightly integrated router
React had a separate routing package from Michael Jackson and Ryan Florence
Vue seems to have a separate package but it’s referred to as “the official Vue router”
Redwood has written their own router which Tom admits is a very risky move because of the complexity involved
What’s the routing story for Svelte?
SM
I think people want an official Svelte router but there isn’t one right now. These are the main options:
Sapper - The closest thing to “official” svelte router. (see below)
Routify - File-based routing (like Sapper) with built-in page transitions and many other features that are routing-related
Svelte-routing - This is like the equivalent of the react router. (Declarative + need setup for serving an SPA)
Svelte-spa-router - Hash based routing
AJC
There is a really prominent trend of what I call meta-frameworks, frameworks built on top of other JavaScript frameworks/libraries. This would include things Next, Gatsby, Nuxt, Vuepress, Gridsome, Blitz, Redwood, etc. Sapper seems to be a really popular choice as Svelte’s meta-framework. Can you talk about Sapper, what it is, and why I would use it instead of just Svelte?
SM
Yeah it’s more appropriate for building a “real world” (ie, full stack and public-facing) website from scratch. It gives you file-based routing, server-side rendering, code splitting, preloading, API creation, progressive web app features, etc. I would use just Svelte if it’s being added to an existing fullstack project or if your app is not for public eyes 👀.
AJC
What’s the community like? Is there a contributors guide? Do you have a code of conduct?
SM
Hmm I mean, I think the community is friendly and not too gate-keepy. But I don’t have much to compare it to. It’s overwhelmingly male that’s for sure. I think people value simplicity which is nice. I hope that it can be a good framework for those without much programming experience.
No CoC. See: Issues #3791
AJC
If people enjoy your videos and want more cool Svelte community resources where should they be looking?
SM
Search “Svelte Rich Harris” on Youtube or in podcasts for delightful videos/podcast episodes. I especially like this one:
SE Radio - Rich Harris on the Svelte Javascript Framework
(AJC: Yes, love that interview and big, big fan of all of Rich’s talks)
Otherwise,
AJC
Where is Svelte currently lacking, and what can we expect to see on the horizon?
SM
Typescript support will come very soon (or is already here when you read this)!
Not a great story for how to test but you can use cypress or check this out: Svelte Testing Library (I couldn’t get it to work very well…)
Because Svelte lets you do a lot of simple and cool things, there are less guardrails against bad practices.
It’s still a baby so doesn’t have a ton of libraries like React and Vue.
Some people feel like they won’t get hired if they learn Svelte instead of React or Vue but in my experience, 2 things can happen:
You use Svelte in the interview and can do tasks way quicker than if you used React.
The interviewer asks you questions in React and you say something like “oh I use Svelte mostly so I’m kinda rusty in React” and then anything you do is more impressive since you get leeway for not really being a “React person.”
AJC
Last question, I’m a huge NLP nerd so even though this has nothing to do with Svelte you studied Computational Linguistics so I really want to hear your thoughts on GPT-2 and in general language models. It seems like we’re still scaling these models up both in number of parameters and size of text corpora. No one knows how far this will go and while I doubt we’ll get to full AGI just with these models they seem to be approaching some kind of general intelligence in terms of their abilities in translation, question answering, and summarization.
SM
RANTY RANT: Yeah NLP has come a long long way for sure. Speech recognition is pretty good now and huge improvements in natural language understanding (NLU). BUT, the reason I’m not into NLP anymore is that it’s so hard to make anything useful. Most examples you see of a language model doing something cool is cherry-picked and when you try to venture outside of it, it breaks down. One thing is that most language models are not built on real conversational text data.
Language is conversation and includes emotion, humor, meta-messages, sarcasm, beliefs, metaphors, references to past conversations, nuance, idiolectal variance, etc. which isn’t easily captured in these models. They mostly just predict the likelihood of words occurring together which definitely has useful applications but isn’t human-like.
Try this: think of some normal English sentences in your mind. Did you do that? Well don’t keep reading until you did that. The next part will be jumbled so you didn’t accidentally read it. Nwo go and raed msegsaes wtih yuor fdneris and see if they are at all similar to the sentences you thought of. In my case, I think of like “Today I’m going to take the day off. I hope the weather’s nice today.” But in my messages I find stuff like “Ohhh yeahhh lay it on me THICC” and “so if i just don't start with them that will be my secret weapon haha”.
The point is, language is weird and conversational and super complex and emotional and nuanced and playful and so much more! But anyway I’m just cynical and don’t get excited by it (can you tell what “it” refers to??) anymore. But there are still great things happening! Just know that it might be more limited than you think :)
AJC
Awesome, huge thanks to Noah for indulging my nerdiness and for all the insightful answers about Svelte. If you haven’t ventured into the Svelte world yet I highly recommend doing so as we’ll be seeing a lot more of it in the future. Keep up to date with the ecosystem at Svelte Master’s Youtube channel and @MasterSvelte.