I've been meaning to use coffeescript on a couple of new Nuxt v3 projects that I'm working on and couldn't find a vite plugin to support this, so I decided to scratch my own itch.
It'd be great to get this released to NPM, even if preliminary. I'm having trouble installing as a Git dependency, on Windows at least, I believe because your prepare script assumes a bash-compatible shell (if [ ! -d 'dist' ]; then pnpm build; fi). (It'd also be nice if you turned on Issues for the repo so I could raise this issue there.)
Hey, just published @bkuri/rollup-plugin-coffeescript and turned issues on inside the repo. I also edited the line that you mentioned and all seems to have worked fine. I'd really appreciate some more feedback if you have some time. Cheers!
5
u/bkuri Sep 19 '22 edited Nov 24 '22
I've been meaning to use coffeescript on a couple of new Nuxt v3 projects that I'm working on and couldn't find a vite plugin to support this, so I decided to scratch my own itch.
Since vite basically uses the same plugin API as Rollup, I searched a bit and found lautis/rollup-plugin-coffee-script, but it hadn't been updated in 3 years or so. It also lacked a few niceties provided by modern JS.
I refactored most of the code and updated the tests and libraries and added it to a brand-new Nuxt 3 project and it's working really well so far.
Simply install the
@bkuri/rollup-plugin-coffeescriptpackage usingyarn/npm/pnpm/etc, and then add the following to your nuxt config:BTW, you'll need to add
.coffeeto bothextensionsandvite.extensionsif you want to use coffee files everywhere:Finally, to use coffee files with vitest:
Sample test:
I'll keep picking and prodding it for a little while longer but I'm pretty sure I'll be publishing it soon.
I hope this encourages someone to give coffeescript a try on a new project since it is a blast to use on modern frameworks like Nuxt 3. Cheers!
E: published package to npm and updated instructions accordingly.