16 ms·
Some notes on using esbuild
- difosfor 5y agoSounds like she should consider just importing her script.js as a module and then import the rest from there. Probably no need for a build step and bundling at all. Also she might want to just use custom elements instead of Vue as your browser also just supports those out of the box.
- emmanueloga_ 5y ago"Ronen Amiel - Build Your Own Webpack" [1] is a great way to understand what a JavaScript bundler does. 1: https://www.youtube.com/watch?v=Gc9-7PBqOC8 https://www.youtube.com/watch?v=Gc9-7PBqOC8
- davman 5y agoI think you should be able to do something similar to the webpack config that Vue ships would be to use https://github.com/igoradamenko/esbuild-plugin-alias https://github.com/igoradamenko/esbuild-plugin-alias and pass in a similar `runtimeCompiler` option to your build script.
- franciscop 5y agoI've recently being helping a friend who is starting with Node.js, and I strongly recommended him (and anyone else getting started now) to use all `import` instead of `require`. I would say it takes a bit more of work because the tutorials are normally written on commonJS (require), but otherwise it's just a different kind of work. Both of them have their peculiarities and issues, and CommonJS might also bite you big time. So if you have to choose, and both give you a bit of pain (for now), I'd suggest to choose the one that is more future-proof. About the article on Esbuild and ESM vs CommonJS, some other personal notes: - Node.js' `import` is more strict than frontend tools' `import`. You can do `import myfile from './myfile'` on the front-end but you need to specify the ".js" on the backend. - You can no longer use __dirname with ES6 modules. That's a feature, and I found that I normally have enough control over where the script is run from that I just prefer write all relative paths instead of bothering shiming it. - The Esbuild from the author is great and I use something similar for simpler projects and libraries I develop. However for making WebApps, I prefer to also have Hot Module Reload. It's like Prettier, at the beginning it feels unnatural and overbearing, but after you get used to it you realize what a huge order of improvement it is vs the way you were used to.
- ricardobeat 5y ago> CommonJS might also bite you big time In which ways? I’ve always found CommonJS to be extremely unsurprising. What will bite you is the tooling built to interoperate with ESM.
- franciscop 5y agoIn the way that some libraries have been updated to be ESM-only, so if you follow a tutorial to-the-letter and then try to require() that library it'll fail with a cryptic error message (at least for new users).
- merrywhether 5y agoFWIW, you can replace __dirname with information from import.meta (and 2 lines of JS). It’s not quite as automagic but can yield the exact same info. You’re also right that it might just be a code-smell in general though.
- franciscop 5y agoYeah, I've had 2 layers of deception there. You think it might be those 2-3 lines from the popular StackOverflow answer, but after hunting a bug for a while I realized that it was url-encoding that space in the path name and saying "directory doesn't exist" when in the console it was obviously correct. Drove me crazy until I realized in the full path there was, early in the path, a single "%20" and my JS senses told me it doesn't make sense for spaces to be url-encoded in paths.
- marcus_cemes 5y agoI find it fascinating that there are people still using script tags. I have personally become so tied to npm and typescript that it feels that I'm programming in a completely different language and ecosystem, with a build process and IDE-like type checking and linting, a more procedural data-oriented C-like paradigm. I've never touched the old JS guts, `module.exports`,the prototype chain, ... Babel (and later TypeScript) allowed me to live in ESM land from the beginning. I expect any tool/library to be available using exclusively on npm, in reality, I've been constantly fighting with it over the past few years. I usually get a shock when I see libraries still offering minified bundles that assign to the global namespace, to me this seems like outdated practice, but I guess that this is still really prevalent in JS, even in 2021. I sometimes want to go back to it, with the amount of configuration and boilerplate necessary to set up a project with npm, Prettier, ESLint, Typescript, Webpack/Parcel/Rollup, SPA vs MPA, React vs Vue vs $SPAFRAMEWORK, it was a lot easier back in the day. I think the biggest failure in the JS system is the lack of standardisation, it's so versatile that almost anything is possible. A number of different module systems were invented to solve the initial growing pains (the first would literaly replace a `require()` function call with the contents of the given file), and we never escaped them as they became the foundations of Node.js/npm. Then we needed a non-blocking variant, so we just called it `import()`, it returns a promise. Then we wanted proper imports, so we invented the `import ... from ...;` ESM syntax. We made a named import and default import variant (with most bundlers offering a compatibility layer with CJS-type exports, so imports now have a hidden `__esModule: true` key...). In order to stay compatible with legacy CJS, we also added the `import * as ... from ...;` syntax as an escape hatch? When TypeScript came along, in order to be compatible with JS it became common practice to distribute compiled TS code along with the source code, with an adjacent declaration `.d.ts` file to provide type information. The source code was never leveraged in any way, and so people just stopped shipping the `src` directory, only `dist` and a `package.json`. It makes debugging a pain, but compiling TS libraries would have been tricky, considering the widely varying different feature flags (async, DOM, ...) and strictness options. Perhaps Deno will help with this to some regard. The great thing about Go or Rust (or any other language, really) is that you import source code, not illegible compiled code (unless you're dynamically linking). I believe that Rust is especially good in this regard, it remains compatible with older code by requiring crates to specify a Rust "edition". Why are we in this mess in this first place? And why has it remained so darn popular?
- hsn915 5y ago> problem 1: libraries that tell you to npm install them Agreed. I wish `npm install` was just some option for those who wanted it. But no! Somehow it became the defacto standard and everyone just expects everyone else to already be onboard. I got onboard reluctently because that's the only way to use the libraries I cared about. > problem 2: I don’t understand frontend build tools Absolute and total agreement. I can't agree enough. I think no one really understands them. > “webpack” which I will not try to explain much because I don’t understand it, I think it’s a system with a million plugins that does a million things I haven't worked with anyone who understood webpack. They just use a scaffold-builder to set it up in a pre-configured way and then you just never touch it. > Recently I learned about esbuild which is a more Unix-style tool. esbuild is the best thing that happened to frontend development. It finally freed us (well, me anyway) from the messy js build systems. But I'd like to strongly object to describing it as a "unix-style" tool. Unix style tools to me are tools that deal with plain text and expect you to pipe them with other tools to get the job done. esbuild is nothing like that. It's the entire build pipeline in one tool. You don't work with it by piping its inputs and outputs to other tools. It provides you a programming interface and you write code to make it do what you want. EDIT: To clarify, I think it's a very good thing that esbuild is not a unix-style tool. I know the common wisdom on HN is in favor of the unix philosophy, but I don't buy into that.
- pastage 5y agoUnix tools should do something well in CLI, and be transparent enough to deconstruct the command into series of commands if it is a complex process. Piping is not always practical (see make). Your definition of a unix tool is a strange one.
- hsn915 5y agoI don't think you understand the unix philosophy. If a tool does everything for you from start to finish, it's not following the unix philosophy. Unix command line tools are basically meant to be like small library functions in an ad-hoc text-based interpreted language. Commands are supposed to be focused on one specific task. More complex tasks are supposed to be achieved by orchestrating several commands in the right order. The interface between commands is a stream of text. https://en.wikipedia.org/wiki/Unix_philosophy https://en.wikipedia.org/wiki/Unix_philosophy For example, one of the core items in the list: > Expect the output of every program to become the input to another, as yet unknown, program. Don't clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don't insist on interactive input. But as you can see, esbuild is nothing like that. It doesn't expect itself to take input from other programs, nor does it expect its output to be piped to other programs. Another formulation: - Write programs that do one thing and do it well. - Write programs to work together. - Write programs to handle text streams, because that is a universal interface. Again, esbuild conforms to none of these points.
- Bellend 5y ago> “webpack” which I will not try to explain much because I don’t understand it, I think it’s a system with a million plugins that does a million things Is webpack really considered such a difficult beast? I was an early adopter of TypeScript so I think I started with grunt, then gulp, then finally webpack 3, 4 and now 5. I mean it's not my main job or anything, and I don't really enjoy configuring things but spending a handful of days reading the docs once a year or whatever is not really a problem. I have a couple of files, one for local one for production. About 50-70 lines each and considering it is compiling typescript, linting, minifying, scss, testing and so on... I find I get a lot of bang for my buck. It's not like the previous tooling was really any easier to deal with. The production build takes about 50 seconds, and the local build takes about 3 seconds. It's honestly the least of my problems.
- IshKebab 5y agoWebpack is definitely a difficult beast because it's sort of an everything tool. It's supposed to be just a bundler but because it supports plugins people use it as a full build system. It doesn't really work that well as a full build system. It's also quite buggy in my experience, e.g. the multi-config feature doesn't really work at all.
- morelisp 5y ago> I have a couple of files, one for local one for production. About 50-70 lines each I don't think you realize how hellish this sounds. I haven't had >100 lines of build configuration in any other environment since my configure.in/Makefile.am days, and even that was more transferable to other tools than Webpack, which is only good for Webpacking.
- Bellend 5y agoWhat would be the alternative in todays projects? Like typescript and scss need compiled, then there are builds which are minified with source maps vs local which isn't, then people want browserlist and scss linting and so on. I don't see how configuration can be escaped but I would be happy to have a path forward to change that if I knew how.
- nawgz 5y agoI found EsBuild via Snowpack was quite nice until it wasn't. I hit issues around package resolution and usage of libraries like Mobx, which was deeply displeasing. I have moved back to Webpack because 50ms vs 400ms refresh-after-save latency doesn't matter to me when once a month I have to spend a day fixing those things I have long since taken for granted
- jetsetgo 5y agowebpack hate is so unjustified now days. It's far superior and stable than these toy build tools and setups.
- tekkk 5y agoEsbuild is great. That said, I find as its one major weakness the inability to alias/dedupe libraries at least in a pnpm monorepo. Even if it's the same version and I assume the same link, it will bundle it twice and you can get some pretty obscure errors when you run your app. I did try various setups but none worked. With Vite at least I was able to alias libraries to same import thus avoiding importing them twice/x times. But I'd kinda prefer using esbuild as Vite can get funky too, especially I've noticed if you build a local library with multiple chunks (eg just using tsc) the HMR will get out of hand. As I just tried, it basically seemed to go on indefinitely. Maybe there's a config for that but it's not nice, I can tell you that.
- LukaszWiktor 5y agoI can relate to the article so much! Even though I'm familiar with node.js and npm, my approach to frontend is also index.html and script.js with no build tools. This way I can at least know how it all works and fix it when something breaks.
- Joeri 5y agoI’ve gotten so tired of the near infinite complexity of the angular / react / webpack / typescript / sass projects at work that for my home projects I’m now exploring no build tool solutions. Modern browsers are now so powerful that a lot of the things we needed build tools for no longer apply: - http/2 multiplexing has made it unnecessary to limit the number of script or css files loaded at once. Faster connections together with http/2 mean payload splitting is no longer necessary for js and css (which means everything can load up front from index.html). Gzipping removes the need for minification. - Any npm package can be loaded as script tags or through direct es6 module import from unpkg.com. I use a single ‘externals.js’ which exports those dependencies so I can just do “import { foo } from ‘externals.js’” - sass is mostly unnecessary thanks to widespread css3 support, @import for modularity (see also http/2), bem notation for namespacing, and css variables for reuse - es6 is supported in all browsers, so you can write modern code. ES6 modules “just work” if you import from a file path. - vue and preact are designed to be used without build tools. An app deployed as a static site can use hash routing to need no builds and no server-side router. Experimenting with this stuff has really made me wonder why we use all of these build tools.
- pitaj 5y ago> Gzipping removes the need for minification. _need_ is a strong word. You don't _need_ gripping either. Both minifying and gzipping still provide substantial benefits. > Any npm package can be loaded as script tags or through direct es6 module import from unpkg.com This prevents tree-shaking and dead code elimination.
- Joeri 5y agoWell, the libraries included at runtime from cdn are still minified. It’s only the app code that is gzipped and not minified, and it is only the very largest projects where minification will make a meaningful difference for the app’s own (not library) code. There is usually no point to minifying the app’s own code. As for tree shaking. When using lightweight libraries meant for the no build path this isn’t necessary because these aren’t pulling in lots of dependencies. Preact is tiny and is a good enough react for my needs. I wouldn’t recommend this approach for large web apps, but most web apps are small enough that a no build tools approach seems viable to me.
- seumars 5y agoAs long as your code doesn't need transpiling, there's also the possibility of importing modules using the type attribute in script tags: <script type="module" src="script.js"> – which is very well supported: https://caniuse.com/es6-module https://caniuse.com/es6-module
- kqr 5y agoThe drawback of this, IIRC, is that if you want any sort of third-party library using this approach, you'll trigger a million HTTP requests, one for each part of the transitive closure of dependencies. Maybe things have improved.
- tazeg95 5y agoYes, you don't need Parcel, Vite, Webpack, Rome or Rollup to code with Javascript. I never understood how to configure webpack and you don't know what thoses tools are doing. Just keep things simple. Write your own bundler with esbuild. Here is a script I wrote to build a Svelte Typescript Tailwind projetct : https://github.com/Tazeg/svelte-typescript-esbuild-tailwind-template/blob/main/esbuild.js https://github.com/Tazeg/svelte-typescript-esbuild-tailwind-...
- cxr 5y ago> there are 2 standards (CommonJS and ES6 modules), and that require is CommonJS and import is ES6 modules Kind of, but not really. There are JavaScript modules as defined by the ECMAScript standard and implemented in Web browsers and anyone else who cares about implementing the spec, and then there is NodeJS, which has its own way of doing things, along with people who refuse to give it up and insist on dragging those headaches into places where you should not otherwise expect to see them. People call the latter "CommonJS modules" (including e.g. the TypeScript team), but in fact CommonJS is a whole thing on its own that NodeJS doesn't actually follow. The thing that CommonJS and NodeJS-style imports have in common is that both used the `foo = require("bar")` convention. To understand the mess that is the current JS ecosystem (and hopefully how to get out of it), people really need to come to grips with recognizing NodeJS's role as an IE-like entity: - 800-pound gorilla - not under the control of the best and the brightest - implements its own share of proprietary (vendor-specific) shenanigans - the people who shamelessly target it and see nothing wrong with doing things this way are the source of the the worst problems within the ecosystem or on a given project - responsible for a massive corpus of legacy junk that you are expected to be familiar with and that it will take years to clean up
- have_faith 5y agoUsing ES mudules everywhere seems to be picking up steam recently. It is annoying jumping between frontend files and backend files in the same project using different module systems. I think in about 6 months not touching common js modules from front-to-back for a whole project will be viable without major quirks.
- jsmith45 5y agoTo my knowledge what node implements is nearly a superset of CommonJS. It is true that a pure CommonJS implementation cannot handle many node packages due to additional features that node has added to the module descriptor, or due to use of node specific built-in packages/globals/extra properties on require, etc. But I was under the impression that node could generally import and handle strictly conformant CommonJS packages just fine in practice. Of course, I won't argue that many npm packages not being conformant CommonJS packages makes things difficult for non-node server-side javascript environments, since they either need to add additional node compatibility, or might need their own package repository.
- istjohn 5y agoTIL strace[1] exists. What a handy tool! 1. https://jvns.ca/blog/2021/04/03/what-problems-do-people-solve-with-strace/ https://jvns.ca/blog/2021/04/03/what-problems-do-people-solv...
- mst 5y ago"Introduction people to strace" is one of the most effective ways I've found to improve their debugging experience. It's glorious. In case it's handy, the two options I find myself telling people about most often are: '-f' to keep tracing across forks, and '-s' to increase the number of characters of strings that get shown when you're trying to debug complete reads/writes. (filtering for specific syscalls and stuff is also really neat but most of the time I just throw a full strace into a file and chop it up with my usual unixy tools from there)
- ceronman 5y agoWhat a fantastic post! I rarely do frontend web development. Perhaps only once every year or two. I don't follow frontend development much, and every single time I need to write some javascript the preferred tech stack of the day is completely different. There are so many tools, so many different ways of doing things. It's completely overwhelming. So I end up doing the same thing the author was doing: just use <script> tags. If I need a library I try to download a minified version of it and put it in a script tag. This is usually good enough for me as I typically use JS for very small things. “pretend it’s 2005”. It works and if something breaks I know how to solve it. For the kind of JS projects that I work on, learning the tooling can easily take 3X the time I need to write the project itself. I know that there are several meta-tools that will automatically configure all other tools for you, but I really dislike them. They usually end up downloading half of the entire internet, and when you move an inch from their preferred defaults everything becomes a nightmare. Esbuild seems like the perfect tool for people like me. It's simple, fast and it allows me to import things in JS! I'm definitely going to look at it next time I'm writing some frontend code.
- akitzmiller 5y agoI know it's just piling on at this point, but I've been doing a lot of software builds and deployment over the last 20 years, mostly in a scientific computing context. Nothing I've dealt with is as bad as JavaScript. I've generated and hacked dozens of autotools builds and written m4 macros of my own; I've hacked CMake builds; written RPM spec files; fixed Rcpp package installs; written and modified innumerable Makefiles; setup Tomcat webapps; and use Python for most of my daily work. I've even hacked around with Boost's build thing. Complexity is not the issue with JavaScript. Stability is the problem. Most devs do not want to "know" build systems. You want it to work most of the time and when it doesn't, you want to be able to find the answer to a problem. You want that knowledge to accumulate over time so that the answer you found the last time still works. Autotools is an insane system, but it's been the same insane for 30 years. Currently using vue-cli with Vue 2 and Vuetify, a configuration depending on a lot of precisely pinned versions to get functional. There is a pile of deprecated library warnings during the lengthy build process that I have no idea how long it will take me to address. Could be a couple of hours, could be several days, could be impossible. Would like to try Vite or esbuild because God knows we could use the speed up, but after investing a couple of weeks to figure out the precise balance of versions that will work and propagating to our 8 or 9 applications, where are we going to be next year? I saw a Tweet yesterday about vite on swc. Is that going to be the winner? I half wish Richard Stallman would take over. How desperate is that?
- deleted 5y ago[deleted]
- rglover 5y agoesbuild is the gold standard. Its creator has done a phenomenal job (and it's still early in its lifecycle). It's the first time I used a JS build tool and didn't scream at the monitor when dealing with nonsensical APIs and error output. Re-implemented a complex setup using it in an afternoon with very few hiccups: https://github.com/cheatcode/joystick/blob/master/cli/src/functions/start/buildFile.js https://github.com/cheatcode/joystick/blob/master/cli/src/fu....
- maxfurman 5y ago
- slmjkdbtl 5y agoMy biggest feeling about learning JavaScript build tools and ecosystems is I learned nothing! I learned a bunch of ways to navigate through man-made unecessary complexities, and end up with no new knowledge in computing. The brightside is it increases my tolerence for bloatware, which is a valuable skill to have nowadays. esbuild is one of the few good tools, it has a ton of features and it's still fast and lean.
- VectorLock 5y agoI'd love a whole series on JavaScript that shares this plain, pragmatic, and information dense style.
- m_a_g 5y agoEsbuild is great. We couldn't fully migrate to esbuild due to some hard dependencies on webpack but we are currently using esbuild-loader which reduced our build times considerably.
- awestroke 5y agoYou can also use the esbuild terser backend for minification. Almost halved the time of our release build
- ymhr 5y agoDo you have any information on how to do this? I've done a quick search but I wasn't able to find any relevant results. EDIT: think I found it https://github.com/webpack-contrib/terser-webpack-plugin https://github.com/webpack-contrib/terser-webpack-plugin Unfortunately, my project is still on webpack v4 so I cannot use this until I update.
- hnarn 5y agoI love reading about JS in a context where I’m not expected to understand everything about every single obscure abbreviation from the past 15 years. Great post.
- emteycz 5y agoIf you want to keep things simple while using packaged libs, there's no need for a build step. You can import ES Modules directly in a script by using URL as module name. Use e. g. ESM.sh as the registry, most NPM packages are available.
- dc443 5y agoFor other readers, it took me a while to figure out that esm.sh is a website you can go to which explains what it is.
- alxeder 5y agothis does not fulfill the requirement of her: 'I could fix them when they break'
- emteycz 5y agoI'd prefer monkeypatching instead of modifying minified and/or compiled code.
- fabiancook 5y agoGreat write up. Would like to direct to skypack.dev too for zero build tool imports as well! e.g. https://cdn.skypack.dev/vue/dist/vue.esm.js https://cdn.skypack.dev/vue/dist/vue.esm.js
- dhess 5y agoSkypack looks interesting. However, as I come from a Nix background, I'd like to a) pin my dependencies and b) do a hash check at install/download time to ensure the pinned package hasn't been modified behind the scenes. Based on https://docs.skypack.dev/skypack-cdn/api-reference/pinned-urls-optimized https://docs.skypack.dev/skypack-cdn/api-reference/pinned-ur..., it appears that you can do a. with Skypack, but this requires a manual step: look up the package in the CDN with curl or your browser and copy-paste the URL into your JS import statement. Is there any tooling to automate this? Also, there appears to be no way to fail the build if the contents of the pinned URL change. Are Skypack users relying on Skypack to ensure that can't happen?
- fabiancook 5y agoOr esm.sh mentioned in another comment https://esm.sh/vue/dist/vue.esm.js https://esm.sh/vue/dist/vue.esm.js
- swyx 5y agoJulia is one of my favorite examples of learning in public as a developer. Her technical chops are unquestioned so when she says things like "I have no idea what import does" it really drives home how much the JS community has to do to bring along the rest of the developer population who just wants to make web stuff occasionally without going to JS Build Tool University. I love this and maybe it would be great for someone who works on the spec/bundlers to write a "Dear Julia" letter explaining things and giving context to specific parts on why things are the way they are, and pointing out clear ways that we as a community should try to improve.
- mat0 5y agoMmm, this article is all you need to understand the current state of modern js: https://peterxjang.com/blog/modern-javascript-explained-for-dinosaurs.html https://peterxjang.com/blog/modern-javascript-explained-for-...
- gkfasdfasdf 5y agoGood article for a beginner like myself, however since it was written in 2017 I wonder if it needs a follow up.
- rob74 5y agoMy thoughts exactly! I'm mostly a backend developer and also fine with doing occasional frontend stuff as long as the build system works, but when npm croaks with one of its cryptic error messages, I wouldn't know where to begin to fix it, and that's extremely frustrating...
- phist_mcgee 5y agoCan you link which Julia you are speaking about?
- alichapman 5y agoThe author of the article
- 5y ago
- Dolo 5y agoI love reading Julia's work as there's such a refreshing lack of pretention about what she does and does not know. Useful and clear. Love it!
- marton_s 5y agoGreat read, kudos for using strace to understand what esbuild does! I should do that more often. This is another reason to favor small and simple tools that do one thing: you can “take it apart” and understand it by using another simple tool. (Simple in a relative sense, e.g. compared to Webpack). By the way for those who don’t know what strace is, it’s a command line utility that prints out system calls of another process, like opening files or network connections.
- michaelghayes 5y agoAll the (great) recommendations in this comment section are a great example of how the js ecosystem works. there are so many great new technologies available for building apps, but standardization and discoverability are far from solved. There are new esm based cdns (similar things have been around since the browserify days), awesome new build tools like esbuild, skypack, and swc that are faster and/or simpler than webpack. new language features have been standardized that reduce the need for various types of libraries, etc. For anyone who doesn't spend an unreasonable time following these developments discovery of all this cool new things seems very tough. On the opposite side of things, as a developer of a library I think is really useful, figuring out how to help people find it, I have no idea where to start.
- onion2k 5y agoI can't decide if the root cause of this problem is in esbuild or in Vue. The fact you can't do "import vue from 'Vue';" with esbuild means either it's module resolver is terrible, or Vue is doing something super-weird with the way it bundles artifacts. Either way, something is seriously wrong. FWIW, "import react from 'React';" works fine with esbuild with no config, so I'm inclined to think this is a problem in Vue.
- Semaphor 5y ago> The fact you can't do "import vue from 'Vue';" with esbuild You misunderstood, they say this is exactly how it works. But they wanted a specific build instead of the default one of vue (the one with the runtime compiler, not default because it has performance penalties).
- jsmith45 5y agoIt could be argued the default was wrong (when originally chosen). If you don't have the runtime compiler, then that means either you: 1. handwrote the the compiled templates, which is rather unlikely, or 2. you are using additional tooling to precompile. If you are using additional tooling to precompile then that tooling ought to handle aliasing to the runtime only version, (or if not using a cli style tool, the instructions for setting up the bundler to use a loader should include setting up the alias). However it is probably too late to fix things, since existing projects will assume the default is the compiler-less runtime, and would perform worse if things were changed, since existing projects would not have the new alias to run-time only version in place.
- mst 5y agoThat doesn't seem like a good comparison because what was missing in her case was the Vue equivalent of the JSX compile phase.
- onion2k 5y agoesbuild works with jsx out of the box. Most of the examples in the docs are jsx.
- egeozcan 5y agoAs a developer who is in this ecosystem so long that it makes me shrug when I think about it, I loved the humble writing style and loved the fact that she could teach me a thing or two. Being able to say "I don't know how this works" requires a lot of experience too, not just confidence. Especially in an interview, people saying "I don't know anything about what you asked", depending on the requirements, can end the interview but could also make the candidate gain a lot of points. Thanks for the write-up!
- myfavoritedog 5y agoIf only more people in all walks of life these days started from a perspective of humility at what they don't know, then were really super careful to avoid giving the impression that they knew more than they did. Sadly... social media, media, law, politics, and even science are all about overstating what should be said with lots of caveats about lack of knowledge.
- oefrha 5y agoIf you're going to have a build step at all, instead of hand rolling your build commands and configs, just use Vite[1] already. It uses esbuild for development and rollup for production (since esbuild is not featureful enough for a lot of production use cases), you get instantaneous startup, hot module replacement, static asset imports, etc. for free. It's from Evan You, the creator of Vue, but it also supports React, which works pretty well with it in my experience. Btw SvelteKit also uses Vite.[2] [1] https://vitejs.dev/ https://vitejs.dev/ [2] https://svelte.dev/blog/sveltekit-beta#From_Snowpack_to_Vite https://svelte.dev/blog/sveltekit-beta#From_Snowpack_to_Vite
- cuu508 5y agoAddressed in TFA: > But I stopped using those tools and went back to my old <script src="script.js"> system because I don’t understand what those vue-cli-service and vite are doing and I didn’t feel confident that I could fix them when they break. So I’d rather stick to a setup that I actually understand.
- loevborg 5y agoShe's doing things the right way here - applying the beginner's mindset, trying to understand things rather than cargo-culting by copy-pasting magical incantations from github. There's just so much incidental complexity in JS tooling, and her instinct to steer clear of that insanity by using Unix tools like esbuild is spot on.
- tgv 5y agoSeems right to me, too, but perhaps it's not the beginner's mindset. My colleague, who is an actual beginner, started the frontend part of a project, read up to the vue-cli scaffolding incantation, copy-pasted it into his terminal and checked in the result. The consequence was that I have to fix the unavoidable breaks and other npm and webpack issues, because he has no clue. Apart from that, debugging the builds is a bad experience.
- oefrha 5y agoFirst, esbuild is meant to be a complete JavaScript bundling platform. It already packs a lot of features, and is in the process of acquiring more. What it doesn't pack natively can be bolted on via the plugin system. It's an end-to-end solution, or almost one (it doesn't give you a dist folder you can just deploy, you still need to add an index.html), not "doing one thing and one thing well", unless you define your "one thing" to be very broad. Secondly, here's an analogy: cargo is too much magic, people learning Rust should apply a beginner's mindset by downloading dependency crates themselves and finding the appropriate rustc command lines rather than using cargo build. Sounds unconvincing?