The Javascript build/bundling eco system is killing me every time I try to get into it.

Me: oh vite, a nice and fast bundle that supports hmr
Me: works like a charm

Well until I discovered that exporting a self contained bundle with Inlined dependencies is not a thing and you have to pray that your framework provides such plugins

The world of js/jsx/tsx bundling, building, tree shaking, transpiling, Inlining, transforming is such a wild west and that on top of an already very unstable layer of different frameworks that work so fundamentally different that you cannot apply a single principle to even 2 of then (from a building/ssr/bundling perspective)

Standards signing off when it comes to building node apps

  • 6
    Welcome to the world of JS. Here is a clown nose for your authentic development experience: 🔴
  • 2
  • 0
    First off, you're not wrong. But what do you mean with self contained bundle?

    This works without a problem if you're not building a lib, which really should not inline its dependencies, as this would mess up the ecosystem even more.
  • 0
    @nitwhiz this works without a problem as long as you use pure Esbuild, webpack and maybe rollup but when theese technologies are mixed and mashed by the framework template/starter and it doesn't work out of the box it doesn't work.

    And yes I would never ever do any processing except transpiling with libs, I talked about apps
  • 0
    @nitwhiz self contained bundle = one or more js files on a folder that I can take throw onto another's computer run node on the entry and it works without a full blown node modules folder
  • 0
    With vite I literally had an issue when it would run (the js deps are libraries, I'm not using any framework) but only in dev mode. When I exported the bundle it just complained it didn't find functions. It was actually giving some warnings but I didn't think it'd matter. Guess what. The warnings were the issues all along. Even though it ran in dev mode it still fd up the built bundle.
  • 0
    Probably will be downvoted for this... but it sounds like you're referring to fiddling and fighting a giant webpack config. If you're doing that in 2022, you're either working on something super super custom, or you've overengineered at some point and brought yourself too far down that path and have entrapped yourself in what you have recognized is bundling hell

    I'd be curious as to what you are building / what the bundling is for
  • 1
    @fullstackclown no, no down vote for you <3.

    So I wanted to do a seemingly quite simple task: making a solid Js SSR app that I can bundle self contained and have HMR (or something similar)

    Solid itself offers SSR support with hydration but no meta framework for it but it's possible to have SSR.

    So I tried a lot but all on the basis of the 'degit' TS template they provide that uses CSR and Vite. I tried `vite-plugin-ssr` which worked the best but creating a self contained bundle was not possible for me. I also tried building it as a node express app with vite-node vavitw and other plugins which (Jay) do create self contained bundles but struggle to compile solid so that it works (weird import things happen)

    I settled on using svelte-kit since it's vite plugin does all the things that I want and well svelte is a nice framework too

    If you want to know more or hell even help me feel free to contact me :)
  • 1
    2002: "Flash is bad because it's all compiled code and you can't change it anymore once deployed, you need the original files".

  • 0
    @Inxentas imo compiled is superior to interpreted
  • 0
    @Nils ah then, confirmed as "something super super custom"

    I cannot immediately help you in this area, though, good luck!
Add Comment