TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why Svelte is our choice for a large web project

326 pointsby overtowedabout 5 years ago

34 comments

overtowedabout 5 years ago
Author here, just wanted to make a note. This isn't written to hype a battle in the holy war. Frontend frameworks are a positive sum game! Svelte has no monopoly on the compiler paradigm either. Just like I think React is worth learning for the mental model it imparts, where UI is a (pure) function of state, I think the frontend framework-as-compiler paradigm is worth understanding. We're going to see a lot more of it because the tradeoffs are fantastic, to where it'll be a boring talking point before we know it.
评论 #22540757 未加载
评论 #22538386 未加载
评论 #22545936 未加载
xrdabout 5 years ago
I love React and I love Svelte. There, I said it.<p>These are the complaints that standout for me with Svelte after using it for a few months:<p>* Sub-par editor support. For me, the litmus test is whether I can use F2 to rename a variable, and it often does not work inside a Svelte template. There are other places where the editor does not know what to do with your code, because it is not pure JS. Vue is much worse with this since so many things are just strings; React really shines with editor support. This makes a big difference when you are using a large project where you didn&#x27;t write the code.<p>* I don&#x27;t love that you have to re-assign a object&#x2F;array variable to get Svelte to notice it changed, and you can do that inside a Svelte template to a const variable and you won&#x27;t get a complaint from the compiler.<p>* Much smaller ecosystem compared to React and Vue, which is expected at this point.<p>Other than this, I absolutely love Svelte. Stores are such an amazing abstraction. Animation is well thought out. Storybook works perfectly. Mostly it is pure JS once it gets inside the browser, so you can debug effectively which is not the case with Vue for example.
评论 #22541100 未加载
评论 #22540291 未加载
评论 #22543412 未加载
DigitalSeaabout 5 years ago
For me, the biggest downside to Svelte is the lack of TypeScript support. This is a massive deal-breaker for myself as well as many other developers. I am also not a fan of the Moustache&#x2F;Handlebars inspired templating, it feels outdated in the face of enhancing standard HTML or going in the direction of something more extreme like JSX.<p>I think Svelte is refreshing, but I would not be comfortable using it on a large-scale web application just yet given the downsides, particularly an enterprise LOB application with many moving pieces. This is why frameworks like Angular, Ember and Aurelia on the front-end lend themselves better to the enterprise and React and other more component-based libraries do not.<p>In terms of community size, I don&#x27;t think that matters in 2020. You don&#x27;t need a big community if you have something straightforward and easy to work with. Great read.
评论 #22542273 未加载
评论 #22541980 未加载
nlhabout 5 years ago
I&#x27;m rapidly becoming a huge Svelte fan. Quick self-promotion plug (but in the name of altruism): I&#x27;ve been working on an open source project that glues together Svelte (on the front end) and Crystal (on the back end).<p><a href="https:&#x2F;&#x2F;github.com&#x2F;noahlh&#x2F;celestite" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;noahlh&#x2F;celestite</a><p>Two slightly obscure (but growing) languages&#x2F;frameworks, but hey, gotta pick a niche. Contributions &amp; feedback welcome!
评论 #22538134 未加载
评论 #22553949 未加载
评论 #22542590 未加载
rikrootsabout 5 years ago
I enjoyed learning Svelte; it was fun to use when I rebuilt a personal project from scratch using it[1].<p>I&#x27;m trying to think of some downsides to balance my enthusiasm for the framework, but can&#x27;t think of any. The article mentions the smaller community as a possible issue, but the community on Discord seem very welcoming.<p>Re &quot;using Svelte means adopting a new language&quot; - it didn&#x27;t feel like that to me. Every framework has its own way of doing things; Svelte&#x27;s way didn&#x27;t annoy me as much as some other frameworks have done in the past (eg: Angular before it became Angular2).<p>I&#x27;ve got another personal project rebuild coming up - I reckon I&#x27;ll be treating that as an opportunity to learn more Svelte.<p>[1] My poetry website (you have been warned!) - <a href="https:&#x2F;&#x2F;rikverse2020.rikweb.org.uk&#x2F;" rel="nofollow">https:&#x2F;&#x2F;rikverse2020.rikweb.org.uk&#x2F;</a> I blogged about my experiences with Svelte, starting here: <a href="https:&#x2F;&#x2F;blog.rikworks.co.uk&#x2F;2020&#x2F;02&#x2F;01&#x2F;Recoding-the-RikVerse-website-Introduction&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.rikworks.co.uk&#x2F;2020&#x2F;02&#x2F;01&#x2F;Recoding-the-RikVerse...</a>
评论 #22540037 未加载
mattkrickabout 5 years ago
I LOVE what svelte is doing. I&#x27;ve been using React daily for the last 5 years &amp; it does the job, documentation is world class, community is great, but it still has sharp edges &amp; parts that feel bad. Things like hooks make complicated things look &amp; feel simple, which is great for 80% of my work, but for that other 20% (exit animations, high frequency re-renders, drag-n-drop without HTML5) I do some pretty atrocious things to make it work. This is where svelete shines.<p>The readme does a good job of pointing out its shortcomings, too. Primarily, no typescript support yet &amp; the unknown bundle size inflection point. As soon as these are solved, I can&#x27;t imagine it not becoming the best (albeit not most popular) solution.
评论 #22541719 未加载
Tade0about 5 years ago
I applaud the effort and will be following this project closely.<p>I love the pragmatism of this framework - no solutions looking for problems or complex, badly documented abstractions.<p>Even if Svelte won&#x27;t be <i>the</i> next generation framework everyone will be using, the ideas it presents are definitely something the web needs.
StevenWatermanabout 5 years ago
Having used Svelte for a couple of projects [1][2], I love it. Compared to my day job working in react&#x2F;redux, it is much simpler, and feels like it has far less boilerplate.<p>There are certainly a few rough edges, but it&#x27;s all related to the immaturity of the language. Specifically, I had a hard time understanding transitions and it wasn&#x27;t at all obvious how to integrate it with D3. Hopefully as it grows we will see improved docs and examples.<p>Also, I&#x27;m holding out for more mainstream TypeScript support. At that point, it would be hard to convince me to use anything else.<p>[1] <a href="http:&#x2F;&#x2F;musetree.stevenwaterman.uk" rel="nofollow">http:&#x2F;&#x2F;musetree.stevenwaterman.uk</a><p>[2] <a href="http:&#x2F;&#x2F;optimisation.stevenwaterman.uk" rel="nofollow">http:&#x2F;&#x2F;optimisation.stevenwaterman.uk</a> + <a href="https:&#x2F;&#x2F;blog.scottlogic.com&#x2F;2020&#x2F;02&#x2F;17&#x2F;minesweeper-optimisation.html" rel="nofollow">https:&#x2F;&#x2F;blog.scottlogic.com&#x2F;2020&#x2F;02&#x2F;17&#x2F;minesweeper-optimisat...</a>
评论 #22540437 未加载
okareamanabout 5 years ago
I watched a tutorial by the author Rich Harris today after reading this link on HN earlier and stopped when he started talking about a DSL he created for Svelte so you don&#x27;t have to write as much JS. I don&#x27;t want to learn another DSL. I don&#x27;t see what the big deal is about compiling. We&#x27;ve have many languages that compile to JavaScript and Google Closure Compiler to tree shake and minify. For years now! Svelte is a nifty DSL to JS compiler that produces small bundles because there is no SDK to back it up or include. Cool, I guess.
评论 #22546429 未加载
crubierabout 5 years ago
I dislike the templating pseudo language of Svelte (and many view frameworks). Maybe I am spoiled by react but I never ever want to write my view logic in anything else than JS. This is my main blocker for Svelte.
评论 #22540579 未加载
评论 #22540052 未加载
dzongaabout 5 years ago
I love svelte. but now resorting to server rendered html pages with sprinkles of JS. shit I work on and I have noticed in the world doesn&#x27;t really need frameworks like react, svelte, vue etc.
评论 #22537916 未加载
评论 #22538336 未加载
评论 #22539214 未加载
mulholioabout 5 years ago
What I&#x27;d hoped to see here was why use Svelte for a <i>large</i> web project. I get the advantages, but devising and maintaining good architecture is hard enough in the more established React paradigm. What do complex and older Svelte apps look like? This is the part that&#x27;s missing for me, not pleasant DX and early-web nostalgia.
评论 #22538078 未加载
Vinnlabout 5 years ago
Ah, I mentioned it on Twitter [1] somewhat prompted by seeing this article, but before reading it, but:<p>&gt; It&#x27;s interesting that Svelte is positioned as a Javascript framework: it seems to be practically a different language, far more so than JS+JSX.<p>&gt; The downside is that it&#x27;s hard to integrate with much of the Javascript ecosystem, e.g. TypeScript.<p>&gt; Yet at the same time, it doesn&#x27;t fully embrace being a different language, so it does not add features like e.g. how Elm supports pattern matching.<p>&gt; It does make it an easier sell, I suppose, which does certainly count for something. Am I missing something else?<p>After having read it, it does seem that the author does both consider it a separate language, but also still presents it as a JS framework. I wonder if the former isn&#x27;t being underestimated?<p>[1] <a href="https:&#x2F;&#x2F;twitter.com&#x2F;VincentTunru&#x2F;status&#x2F;1237422539128868865" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;VincentTunru&#x2F;status&#x2F;1237422539128868865</a>
评论 #22538802 未加载
nailerabout 5 years ago
Going back to React a week ago after doing Svelte seriously since Oct 2018 is tough. Asides from the obvious stuff - Svelte&#x27;s speed and bundle a size of 0: JSX isn&#x27;t HTML, using weird helpers to enable a class when a JS ternary would do fine, setting state is clumsy, and there&#x27;s way too much complexity if you&#x27;re not already used to using React.<p>That said, I&#x27;m also really enjoying TS so could understand why someone may want to stick with React for a new project until Svelte gets TS.<p>My big Svelte project isn&#x27;t public but my personal site is a Svelte app too: <a href="https:&#x2F;&#x2F;mikemaccana.com" rel="nofollow">https:&#x2F;&#x2F;mikemaccana.com</a> source is at <a href="https:&#x2F;&#x2F;github.com&#x2F;mikemaccana&#x2F;mikemaccana.com" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mikemaccana&#x2F;mikemaccana.com</a>
pier25about 5 years ago
I love many things about Svelte but after using Vue for a couple of years I wouldn&#x27;t go back to single file components.<p>The idea of having markup+logic+styles in the same file works for small components but it gets muddy on bigger ones. It can be argued that components should be as small as possible but OTOH having to create a new file for every damn component gets old very quickly.<p>For the past 2-3 years I&#x27;ve been working again with JSX based libraries and being able to create micro components on the same JS file makes a lot more sense.<p>I&#x27;ve also gone back to regular SASS and moved all CSS outside of components (except for dynamic CSS). It works better IMO than single file components.
sergiotapiaabout 5 years ago
I like what I see from Svelte but I&#x27;m afraid it&#x27;s going down the exact same road Meteor did.<p>Too many options, not enough Blessed Solutions for basic things.<p>Take routing for example, in Svelte you have a lot of options but no real #1 &quot;Svelte Recommends (tm)&quot;. They should solve this problem before it gets out of hand. It killed Meteor.
评论 #22538613 未加载
TekMolabout 5 years ago
I have switched to pure HTML&#x2F;CSS&#x2F;Javascript for frontend. And I am very happy with it.<p>I sometimes use external libraries. For example handlebars if I want to template something clientside.<p>But no more frameworks.<p>I think pure Javascript is plenty enough these days.<p>For those who can&#x27;t live without a framework: What would you miss?
评论 #22538221 未加载
评论 #22539181 未加载
评论 #22538718 未加载
评论 #22537993 未加载
评论 #22537686 未加载
评论 #22537977 未加载
评论 #22539369 未加载
评论 #22537665 未加载
leejoramoabout 5 years ago
I am on a team that has chosen Svelte to replace Riot.js. It has been an excellent experience. We have found that since Riot and Svelte have some similarities in structure and do not use a shadow DOM, we that our old Riot code and new Svelte code co-exist while we build new features and slowly migrate everything.<p>Our team has diverse experience with the other tools in this space. I would say that the consensus is that Svelte is far more intuitive and <i>fun</i> than other tools.
d0100about 5 years ago
I want my templates as first-class citizens. If I have to deal with strings and weird, half-baked syntax for loops and conditionals, I&#x27;m out.<p>JSX really spoiled me to the point that if there isn&#x27;t JSX, I don&#x27;t want it.
评论 #22542951 未加载
finchiskoabout 5 years ago
Shameless plug. I&#x27;ve choosen svelte for webextension that will be allow you to record, replay and modify requests on the fly. I&#x27;ve choosen Svelte, because 1. courisity and 2. it can compile to webcomponents and also reference webcomponents in normal svelte components. I discarded the webcompoments for everything idea, mostly because clunky passing and registering events with svelte (svelte issue). There few thing that needs to be polished, like typescript support and this events handling with webcomponents, but overall, very satisfied with svelte so far (as former React guy).
vosperabout 5 years ago
I enjoyed the brief period I spent playing with Svelte. I ran into some bugs with the built-in animation support when changing states (there&#x27;s built in animation support for changing states!) that I couldn&#x27;t resolve, and which were pretty glaring in the UI. This was 6-9 months ago, though, so it may well have been fixed by now.<p>I&#x27;d really encourage all front-end devs to take Svelte for a spin, if for no other reason than to see a framework really trying to do things differently. There are a lot of nice ideas in there, and the works-out-of-the-box level is admirable.
chowardabout 5 years ago
&gt; Svelte is one of the 6 JS frameworks in the (flawed) State of JS 2019 survey — 75% have heard of it, 7% have used it, and 45% are interested in learning more<p>Why is it flawed and why are you citing a flawed study? You mention that it&#x27;s flawed twice but then immediately cite data from it. If you&#x27;re telling me it&#x27;s flawed why should I care about the data?
评论 #22538388 未加载
评论 #22538377 未加载
awinter-pyabout 5 years ago
hate all frontend compile steps from a developer productivity perspective but love it from a user value perspective, especially if that enables JS-disabled browsers to more or less use dynamic sites
afracaabout 5 years ago
Slightly offtopic: Why a git repo for a blog post? I guess there are some pro&#x27;s: public history, PR&#x27;s , but a blog has comments directly under the article for example. Forking is not expected. Ah well, extensive information anyway, good work :)
评论 #22541136 未加载
smithzaabout 5 years ago
Especially excited to consider a solution without huge runtime libraries (think jQuery, React, Vue). Minimizing web page sizes and enabling dynamic content (which is a mainstay in modern websites) is a huge plus.
评论 #22538310 未加载
elliotfabout 5 years ago
I love svelte on the personal&#x2F;toy projects I&#x27;ve tried it on, but does someone have an example of a large-ish svelte codebase with an example of a testing pattern that they&#x27;ve found works?<p>Using mithril&#x2F;vue&#x2F;react, there are assertions you can make about how a given action will modify the state, and given some state, how that state will be rendered.<p>I&#x27;ve not found a good way to make assertions on the behavior of code without resorting to poking through the DOM and dealing with asynchronous behaviors.
评论 #22540960 未加载
config_ymlabout 5 years ago
I love the idea of svelte and want to try it on my next project.<p>The compiler paradigm is really powerful. What if you could extend Svelte to give it knowledge of your db schema and it would figure out an optimized way to load data by generating all that code if needed. Probably something like this exists already somewhere and was forgotten about, but one can dream.
Can_Notabout 5 years ago
How is it that 23 hours in and nobody is pointing out that svelte&#x2F;sapper just freezes on runtime errors without the ability to show an error page or report them to a tracker like sentry&#x2F;rollbar&#x2F;etc.? This is one of the biggest barriers to being production ready or fit for use in large projects.
评论 #22546588 未加载
hinkleyabout 5 years ago
The one thing that gives me reservations about Svelte is that the description about how code turns into web pages makes me wonder if there are any problems with code-build-run-test cycles.<p>I&#x27;m concerned I&#x27;ll spend all of my time restarting my application to validate changes. Is this a non-issue?
评论 #22545091 未加载
blaydatorabout 5 years ago
The lack of a large and mature ecosystem would prevent me for starting a &quot;large&quot; web project. Svelte is still missing UI frameworks like Material UI or Vuetify. Won&#x27;t you need date range picker ? Full powered data-tables ? Treeview ? Advanced cards or other layouts ? Awesome effects &#x2F; styles for a rich UI ? Svelte Material UI is a start : <a href="https:&#x2F;&#x2F;sveltematerialui.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;sveltematerialui.com&#x2F;</a> But I will definitely give Svelte a try for my next &quot;medium&quot; size project.
评论 #22544469 未加载
abledonabout 5 years ago
does svelte have a way of hiding the .svelte components from the users on the frontend? e.g. so they cant blatantly rip the source code in your components and reuse them
评论 #22538320 未加载
theslurmmustfloabout 5 years ago
Use next.js the auto routing and ssr is a game changer, plus easy access to the huge react community
camccarabout 5 years ago
As a javascript developer, I was getting nervous almost a day had gone by without another framework.
评论 #22538021 未加载
_prototype_about 5 years ago
Svelte is absolute trash.<p>It actively encourages mutability, which is a one way avenue to bugs bugs and more bugs. ie, shit like this is all over the official documentation:<p><pre><code> &lt;script&gt; let mutable = 1; function f1() { onMount(() =&gt; { mutable = &#x2F;* do some complex shit here *&#x2F; }); } function f2() { onMount(() =&gt; { mutable = &#x2F;* do some complex shit here *&#x2F; }); } &lt;&#x2F;script&gt; &lt;Component onclick={f1}&gt; &lt;Component2 onclick={f2}&gt; &lt;&#x2F;Component2&gt; &lt;&#x2F;Component&gt; </code></pre> Complete non-deterministic state changes. Absolutely abhorrent stuff. Cannot believe my coworkers and others actually like using this absolute garbage of a framework.
评论 #22537848 未加载
评论 #22538279 未加载
评论 #22537790 未加载
评论 #22537883 未加载
评论 #22537690 未加载
评论 #22537671 未加载