Are we ready for javascript without a build step on the front end in 2023? - eviltoast

On the current typescript / anti-typescript internet drama I saw someone mention javascript without a build step.

Do you think we’re already there?

Last time I attempted it:

  • there were too many libraries I couldn’t import
  • JSX (using babel) had a warning saying you shouldn’t do it in the browser for production
  • there was some advice against not using a bundler, because several requests for different .js files is slower and bigger than a bundled package
  • towerful@programming.dev
    link
    fedilink
    arrow-up
    12
    ·
    edit-2
    1 year ago

    Http/1.0 would require serial connections, and the “multiple files bad” absolutely applies. Bundling and minification into a single JS file was common, even required - and I would consider that a build step. Otherwise you are dealing with all your code in a single massive file.

    On http/1.1 browsers would open 6-8 concurrent connections to fetch files simultaneously. At this point, code splitting had benefits.

    Most webservers now run http/2 which can fetch multiple files at the same time over the same connection. I believe it is “virtually unlimited” and the initial connection setup - which is often the largest performance hit - only happens once. At which point code splitting has such little impact on the transport layer, that it is more perfomant than transferring and loading all the code.

    https://blog.vespa.ai/http2/ Has an more details as well as some load testing against http/1.0, http/1.1 and http/2