103 points · by lastmjs · 6y ago · 126 comments
i.e. some thing that does everything for me apart from the bit where I write application and presentation code? That mostly just works and doesn't require me to understand the whole stack.
Because when I switch to other languages/environments I can most remain blissfully unaware of the plumbing that keeps the thing running. I learned all I needed to learn about pip and virtualenv in under an hour. My C# editor just lets me edit code and hit play.
Is there any chance of getting to this state of nirvana for web development?
Want to build your react app? Just tell parcel where your index.js is and it will see your react and react dom imports and just build it. No config needed.
Want to do react in typescript? Just change your entrypoints to index.ts. Done. Even handled the yarn add commands for you.
This allowed me to easily have a few different react entrypoints as well as just a few random .ts files for use on pages that aren't built in react yet and then I just watch or build using a wildcard and it takes care of it all.
So far, I'm a big fan.
For most purposes I find that all these frameworks are simply unnecessary. As a bonus, all the debugging tools in Chrome work much better when there's no obfuscation or packing, and "recompiling" is just Ctrl-R.
Code size and load speed is also massively better than it would otherwise be. Pages load instantly. It's nirvana, I tell you.
Provided you really need so much bulk at your disposal. But that’s a different story.
JQuery / lodash: we’re slowly getting better about modern browser availability and needing these less, but it’s a long road.
Parcel is probably the closest to zero-config that I've seen. Only drawbacks are when you want to do something "off the rails". I'm guessing this project will be the same.
Of course, if you're not worried about supporting IE11, you could waive any built step and be absolutely fine. Gzip is more important than minifying.
I have not needed to touch any of the config files and it “just works”. I got turned off by React and Vue where you need to learn a build tool and write your own config.
Yes, you don't get JSX this way, but I've always seen people's obsession with syntactic sugar as bikeshedding. Typing out code isn't the bottleneck for development, it's just one of the easiest things to optimize, so people obsess over optimizing syntax while much more significant problems like debugging and traceability are largely ignored because people don't understand them as well. Worrying about losing the benefits of JSX when you're writing a language that still fails silently when you reference a mis-spelled property on an object is like worrying about your haircut while you bleed out from an arterial wound.
Not anymore.
That means that the module approach isn't faster than bundling, but with HTTP2, the module approach shouldn't be slower than bundling.
But yeah, probably not a terrible way to go. If you are working with an http2 server today then this will work really well.
Some examples: https://svelte.dev/examples
I'm one of those people who is very, very suspicious of imports, and barely ever uses anything outside Vanilla JS, but even with that mentality I have to admit that some libraries have their place. These days I usually use Preact (basically a stripped-down React) and I've not really come across much that it can't handle.
The key for me has been to just write isolated components, and avoid the "full page application" anti-pattern that is so common in web applications today. React doesn't force the anti-pattern on you like other frameworks, so I've had pretty good luck with this. It results in fairly clean, reusable code, and users see positive benefits because it allows me to create consistent, predictable interfaces.
Can you elaborate on what you run into?
EDIT: Forgot to mention component template co-location, which is pretty great, too.
Which do you use?
That being said, I support the effort to make a simpler, superior bundler. My disagreement is more so with the marketing in the title. Though, those sort of claims are what drive clicks today.
I'm OK with people pining for simpler times. There's a lot of projects that are overcomplicated these days. But the good old days of web development didn't require three files for "Hello, World."
The submission title is provocative and personally I'd say misleading. As can be seen in other comments, it can lead to badly framed discussions and general dislike about the project. The project readme doesn't even mention Webpack, so why is the leading phrase "Webpack killer" in the title?
The repository readme is very long. As a dev, I'm looking to capture the core concepts of a project from the readme: what is this thing, is it relevant to me, and how does it compare to other things? Most of this information is covered, but there's a lot in addition. I'd recommend moving everything about specific languages to separate files and simply reference those in a list.
"Also...Zwitterion is NOT a bundler. It eschews bundling for a simpler experience."
I get that, run locally, it's not bundling, but how is it not a bundler when running static builds for production?My hobby project uses web components with lit-html as frontend. I was frustrated with bundlers. They are probably neccessary in production, however I just wanted to have a smooth code-test loop! A few minutes with my newly created dev server and I soon figured out an old stupid little problem which was stumping me before just because I didn't have a quick code-test loop.
The lynchpin here is the import map. With the import map there's an alternative to bundlers. Instead of transpiling whole projects with all their dependencies, you just let fetch all modules. I know, this doesn't scale, but for quick experiments this is almost too simple to be true.
It doesn't seem to support importing css or image files. I don't use them, but the webpack css-loader and image imports seem popular.
I will most likely add those soon. I will also be exposing a plugin system (currently it's just internal) that allows for others to add functionality that Zwitterion core will not support.
1. This doesn’t bundle
2. This doesn’t support source maps
> Also...Zwitterion is NOT a bundler. It eschews bundling for a simpler experience.
Zwitterion is not a bundler. I believe the world will move away from bundling, and that Zwitterion can replace Webpack eventually.
<script id="myGeeks" type="text/tsx">
// ... script here
</script>
This really would be a great addition if not, and help drive the narrative that this brings simplicity back to that of "the old days" of web development (:In the case above, you would need to say type="module", because you are importing a module even if it is tsx. But, you should be able to set the MIME type for .tsx files with a custom header file
Webpack does more than just module importing though. Tree shaking, minification, uglifying, compiling SASS and a lot more.
That's unfortunate, and really limits the packages that can be used with this. Parcel does appear to support `require()`. Is this something you might add in the near future?
But there are a lot of commonjs modules out there, and many/most of them will never migrate to ES modules. It's such a significant downside compared to Parcel that I'm honestly not even inclined to try zwitterion out, let alone get involved with the project by making detailed feature requests.
Like, what made the good days go bad? What is this supposed to be better than?
In "the good old days", you would just import a script using a normal <script> tag, it would do stuff on the page, and you're done.
What a lot of people refer to as "modern" web front-end development, there is a whole toolchain needed to compile and prepare your site for deployment: babel, webpack, etc. While these front-end tools solve a host of problems, they also introduce a whole set of new ones, mainly around complexity and the fact that what is actually going on "under the covers" is a lot more opaque to the front-end developer.
I jest of course, but while frontend tooling has gotten quite complex, there's a good reason. Transpiling, minifying, and tree shaking are non trivial, and pretty much a requirement if you want to build a rich client (though not everyone needs one).
Seriously: it's like you're trying to nuke the moon. This is why people legitimately grief about "the ecosystem".
My own personal theory is that because the barrier of entry is so low, people get a little too excited about being a contributor and solving a problem "differently" (sometimes before even understanding the problem space well enough). In short - lot of it is inexperience.
edit: Look at Blazor and Yew for example, these types of frameworks can and will replace the bulk of what we use JS for today.
It's funny tough, people are starting to pump giant runtimes over the air just to get C# running on the frontend, while people already complaining about JS bundle size smh.
Currently WASM is a way worse in terms of shipping on the web. On top of wrapper JS scripts, .wasm files are treated as statice files like image files. You have extra burden with the path of every .wasm files.