Live data from Hacker News

Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

nauman.medium.com

71–80 of 101 posts

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#71
post #5

It's telling that most instructions deal with the Javascript toolchain and not Rails itself. And let's hope that everything works and none of the 2000 imported node_modules blow up when this tutorial is 3 months old. I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome.

It seems that swc is gaining more traction than esbuild, deno is using it, nextjs hired swc dev and rome is using swc too. Also one limitation by design of esbuild is lack of customization, you cannot hook into esbuild and do your own things, but I read you could with swc. But either way, both are way faster than the most popular ones.

One thing that's important to keep in mind is that esbuild is a bundler, in that it can take an input file that imports other JS files and create an optimized ready-for-production output bundle file. SWC cannot, yet, accomplish this.[1] It is in the works, however! But if I was choosing a replacement for Webpack to use today, I'd definitely go with esbuild.

[1] https://swc.rs/docs/spack-basic/#mode

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#72
post #36
post #5

It's telling that most instructions deal with the Javascript toolchain and not Rails itself. And let's hope that everything works and none of the 2000 imported node_modules blow up when this tutorial is 3 months old. I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome.

> I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome. I don't like the churn either, but ditching X for Y only contributes to the churn.

This is too broad to be true in general. It depends on what Y is...

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#73
post #36
post #5

It's telling that most instructions deal with the Javascript toolchain and not Rails itself. And let's hope that everything works and none of the 2000 imported node_modules blow up when this tutorial is 3 months old. I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome.

> I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome. I don't like the churn either, but ditching X for Y only contributes to the churn.

Phoenix is the maintainer of the Elixir esbuild package--it's just a binary.

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#74
post #5

It's telling that most instructions deal with the Javascript toolchain and not Rails itself. And let's hope that everything works and none of the 2000 imported node_modules blow up when this tutorial is 3 months old. I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome.

> And let's hope that everything works and none of the 2000 imported node_modules blow up when this tutorial is 3 months old. We have recurring Jira tickets for updating npm dependencies every two weeks. One developer is occupied between half a day and two days because the amount of breakage in the npm ecosystem is enormous. It’s ridiculous and sucks the life out of us.

I sincerely do not understand this complaint. Do you dislike bug fixes and new features? Would you be happier with a stagnant tooling ecosystem?

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#75
post #5

It's telling that most instructions deal with the Javascript toolchain and not Rails itself. And let's hope that everything works and none of the 2000 imported node_modules blow up when this tutorial is 3 months old. I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome.

I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild.

So am I!

I read Mitchell Hanberg's blog post on using it with 1.5 a while back: https://www.mitchellhanberg.com/how-i-handle-static-assets-i...

I found it compelling but was concerned it was a bit early and not enough others would be using esbuild that issues I hit would be googleable. Now that it's the Phoenix default, that won't be a problem.

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#76

Creator of Tailwind here — if you don’t want to go deep into JS tooling and really just care about spitting out a CSS file, it's a lot simpler to just use our CLI tool: https://tailwindcss.com/docs/installation#using-tailwind-cli

Good to note!

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#77
post #70
post #53

Earlier quoted context omitted.

That sounds like a nightmare waiting to happen. You have a package which hasn't been upgraded by your team for two years and suddenly someone finds a vulnerability in every version before 3.xyz.something. When you check, your version package is 1.3.5. Now you have to upgrade multiple major versions, and in all likelihood the package had transitive dependencies which have had many updates themselves as well. After sev…

Another option is to ditch the dependency and roll your own, which for many things will be Good Enough(TM), especially as the JS standard library becomes more useful. Like, do you really need to import half of lodash or ramda just so you can one-line a few calls?

I try to be judicious about adding dependencies, but Lodash is very well-understood and stable. It's actually the type I would add without any concerns whatsoever. I can't even remember hitting an issue due to it making a breaking change.

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#79

Creator of Tailwind here — if you don’t want to go deep into JS tooling and really just care about spitting out a CSS file, it's a lot simpler to just use our CLI tool: https://tailwindcss.com/docs/installation#using-tailwind-cli

Any plans for adding integration guides for back-end frameworks like Rails and Phoenix?

It seems like Tailwind is popular enough now to support guides for more than just JS frameworks and Laravel :)

Re: Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

#80
post #5

It's telling that most instructions deal with the Javascript toolchain and not Rails itself. And let's hope that everything works and none of the 2000 imported node_modules blow up when this tutorial is 3 months old. I'm looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome.

For the record, next Rails version (v7) is on the path of ditching webpack, too.
Post reply on HN