title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
x
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
|
Thursday, August 12, 2021 | |
NOTE: Snowpack is obsolete at this point, which makes this post, um, less useful. If you've been working with JavaScript for a while, you'll know that things have changed from the day when the code end users saw in production was the same code you hacked with your hands. Though I might prefer the days of Vanilla.js, it's gotten nearly impossible to hold a job without knowing how to transpile code. If you're still on the Vanilla side of the chart, transpiling JavaScript code is when you take a recent version of JavaScript, or, more properly, ECMAscript, and essentially compile it into an older, more compatible version. Transpiling is a "source-to-source" compilation, from one programming language (or version) to another, so to speak. Maybe you want to use "farts" or "fat arrow functions" where you can exchange this code...
... with the shorthand...
Or maybe you want to use shorthand property definitions, which turns this:
... into...
Or maybe you just want to use Or, even better, maybe you want to use TypeScript, which is a great idea, bringing along the bug-squashing safety of strong-typing without sacrificing the abilty to go full dynamic when you need it. You get the point. JavaScript keeps adding features (as does TypeScript), but older browsers won't magically support all of them. You need to turn your cutting-edge code into something [insert lowest common denominator based on your browser requirements] can run. That's transpilation. Even if you're not going to transpile something, you need to be aware of how it works so that you can pick the right tools for your projects. I'll probably make a video at some point, but I would like to quickly get down the steps I think I'd take when moving from a vanilla, es5-compatible JavaScript codebase. Notes, warnings, and caveatsWhy target your transpilation for es5? es5 is the latest version IE supports, as a benchmark. es6 requires more modern browsers. Luckily requirements to support IE seem to be going the way of the dinosaur. That said, I haven't (yet) run into a situation where a transpiler balks at targeting es5. That is, why not include IE if transpiling to something newer buys me nothing? Everything I can do in es6 I can, thanks to some insane transpiler shimming, do in es5. Warning: This is not going to be a howto, I'm afraid, but a command recipe for those who already kind of know what they're doing. It's also not a really nuanced recipe. For instance, when you run So use at your own risk. And to be overly clear, this is for browser development, not server-side node dev, natch. Recipe to move es5 codebase to modern JS (with snowpack, webpack, & babel)Here's the 10,000' view:
Here are the specific steps:
Suggested initial
|
|
| |
All posts can be accessed here: Just the last year o' posts: |
||||||||||||||||||||||
|