Microblog

Continuing in my quest for nice Vue DX without build steps… I’ve learned two things:

- Even tho I’m using a downloaded ESM browser version, I can still install the Vue npm package and refer to its types from JSDoc.

- The composition API is much easier to type than the options API.

social.lol/@bw/111313172895016528

Vue devs, help!

Trying to get type support in regular JS using Vue’s ESM browser build.

Inside of the hasName computed value, VSCode thinks `this` refers to the `computed` object rather than the Vue app. What can I do here?

const test = createApp({
  data: () => ({
    name: 'Testing'
  }),

  computed: {
    hasName() {
      return !!this.name;
    }
  }
});

social.lol/@bw/111309530389909270

Another piece of nice-vue-but-no-build-step is using ES modules. That let’s me separate out components into their own files.

Still exploring type support, but adding a jsconfig.json with checkJs turned on is the first step. It kinda misinterprets things when using Vue’s options API, so it might be that the composition API is better for this use case.

social.lol/@bw/111308874619186766

If you often embed other languages into JS template literals (and you use VSCode) then I have the extension for you.

This baby lets you hit a shortcut, pops open a tab with just the contents of your template literal, and sets the syntax mode accordingly. Now you have full editor support for the given language!

It syncs everything you type back to the original file and saving the tab just saves the original file. It’s a lil weird, sure, but kinda neat.

marketplace.visualstudio.com/i

social.lol/@bw/111308636085686309

I hate npm so much. I had a situation where I couldn’t work on a project because I couldn’t get the dev environment running locally.

I’ve gotten to the point where I hate even having a build step at all. The benefits are not worth it in the long run.

I feel like I should be able to create a moderately complex website (or even a web app) and it should be able to run for a minimum of five years without needing compatibility updates.

The worst part of this is that the web platform is probably one of the most backward compatible runtimes in the history of computing. You can take some HTML/CSS/JS from 20 years ago and it will probably run just fine in a modern browser now. Build steps ruin this.

If you build a web application with no build steps, you could pick up working on that project a decade from now and not have to worry about not being able to work because of compatibility issues.

There has really never been a better time to ditch build steps. CSS is awesome now. It has variables. It has nesting (maybe not everywhere yet but still).

Code organization? Modern browsers support ES modules, so it’s not like you need one gigantic bundle.

As @jimniels@mastodon.social said, if you are writing JavaScript in VSCode, you are using TypeScript. You get a lot of editor support without actually needing to build anything.

I can’t speak to other frameworks, but Vue works great in the browser without a build step. No, you don’t get to use the official single file component feature, but with ES modules, you can get something kind of close.

There is also Alpine.js which works really great with existing HTML.

There has really never been a better time to ditch build steps. CSS is awesome now. It has variables. It has nesting (maybe not everywhere yet but still).

Code organization? Modern browsers support ES modules, so it's not like you need one gigantic bundle.

As @jimniels said, if you are writing JavaScript in VSCode, you are using TypeScript. You get a lot of editor support without actually needing to build anything.

blog.jim-nielsen.com/2023/the-

social.lol/@bw/111293269878244740

The worst part of this is that the web platform is probably one of the most backward compatible runtimes in the history of computing. You can take some HTML/CSS/JS from 20 years ago and it will probably run just fine in a modern browser now. Build steps ruin this.

If you build a web application with no build steps, you could pick up working on that project a decade from now and not have to worry about not being able to work because of compatibility issues.

social.lol/@bw/111293267571727758

I hate npm so much. I had a situation where I couldn't work on a project because I couldn't get the dev environment running locally.

I’ve gotten to the point where I hate even having a build step at all. The benefits are not worth it in the long run.

I feel like I should be able to create a moderately complex website (or even a web app) and it should be able to run for a minimum of five years without needing compatibility updates.

social.lol/@bw/111293266036805485

For the lazy vanilla JS peeps out there, I submit to you the following:

```
const qs = (selector) => document.querySelector(selector);
const qsa = (selector) => Array.from(document.querySelectorAll(selector));
```

social.lol/@bw/111291049147329631

Regarding the Cloudflare app, I used 11ty to generate the frontend site. It uses Alpine.js for interactivity and Pico CSS for styling. Deployed to Cloudflare Pages.

The backend API is Hono running in a Cloudflare Worker. I used Cloudflare’s embedded SQLite database (D1) for data storage.

It was a little bumpy figuring things out, but the docs are pretty helpful. I find Cloudflare’s UI and docs less intimidating than AWS.