`bun-plugin-elm`: import { Elm } from "./Main.elm" (Made by Hand, btw)
Last week I replaced Vite and all its deps and stuff with two Bun scripts and felt rather pleased with myself. The footnote at the bottom hinted at something even better, and here it is. Lo and behold, the scripts are now a reusable plugin! 🥳
A bun plugin isn’t so hard, really
The main problem to solve is as follows: Bun has no idea what a .elm file is. So build.js (in my previous iteration, before the plugin) ran elm make, waited for it, and only then handed index.html to Bun.build. And dev.js (again, previous iteration) spawned elm-watch hot on the side and killed it again when its time had come. A perfect fit for that particular project, yes, but if we’re being honest it’s quite a bit more reusable than that. The Right™ solution would be a plugin!
评论
?
参与讨论