WEBPACK alternative in Phoenix Framework?

Hello,
i am facing difficult using webpack when to install within phoenix framework 1.5.7 because the webpack is still version 4.x.x infact the webpack now in version 5.x.x, configuring that is more painfull, i hope there is another alternative package…

2 Likes

Corresponding tweet for this thread:

https://twitter.com/dev_talk/status/1350182983953768448

Share link for this tweet.


Related portals:

Looks like 5 support will be coming very soon @ariandanim

1 Like

Thanks Aston, i will waiting for it… now i am try develop my app phoenix with webpack 4, when the webpack 5 is shipped, i will upgraded…

1 Like

The PR contains all necessary information to make the update to webpack 5 :slight_smile:

2 Likes

You could try Snowpack. Haven’t tried it myself though, just seen it mentioned on HN several times.

1 Like

I wonder if you could extract the steps and post them here? Might be helpful for anyone searching for the same in future? (Or we could just link to an EF thread if one already exists :blush:)

Snowpack get’s a mention here (from this thread):

Hadn’t even heard of most of those :rofl:

2 Likes

Steps to update to webpack 5 have been extracted in this post :slight_smile:

2 Likes

I’ve been toying with Vite to see if it’s compatible enough with backends like Phoenix. Vite uses esbuild and still bundles for production. The speed is great, but the workflow is different in that it requires another web server (in addition to Phoenix) to take the http requests during dev. I think that’ll be ok, but it’s different.

The current problem I’m running into with it is successfully killing the Vite dev server when I kill my local server. I may have to write a nodejs wrapper like this to listen to stdin.

If I get somewhere acceptable with it, I’ll probably write a post on my blog

1 Like

Every few months on one of the Elixir apps I maintain, Webpack would shit the bed and I’d have to spend a day fixing it. I’m not experienced enough with the front-end stack but I took a few hours to switch to Parcel and I’ve had ZERO issues since. This specific app has 2 large Elm components and Parcel handles Elm without any issues.

I have no idea what’s “better” than Parcel, but I was impressed with how simple it was to configure and how stable it’s been.

3 Likes

I wonder if you could write up/blog a quick guide Jesse? I think more and more people prefer simplicity these days, especially when it comes to JS and so could prove helpful to a lot of people (and maybe even convince the Phoenix team to look into it) :blush:

Please also keep us posted on how you get on @dbernheisel! :smiley:

3 Likes

I can, should, and I promise I will! :wink:

2 Likes

Looking back over the commits, it looks like I based my changes on Dwolla’s writeup so I’ll just link to that :stuck_out_tongue_winking_eye:

1 Like

tldr; still lots of moving pieces, still good to wait if you’re considering Vite.

Following up about Vite and Phoenix, earlier in the Vite beta I was unsuccessful to get them to work well with each other, but Vite’s beta evolves quickly and may change to make it better. After my attempt, someone else stepped up and got it working, so check out their guide (IMO it’s still a little rough):
https://mindreframer.com/posts/js-bundling-with-instant-live-reload-for-phoenix-and-liveview/

My test repo: GitHub - dbernheisel/vite-phoenix-test

lostkobrakai’s test repo: GitHub - LostKobrakai/phoenix-vite

2 Likes