elysiajs / elysia-html

A plugin for Elysia that add support for returning html
MIT License
25 stars 18 forks source link

Runtime error after just importing the module #84

Open mrctrifork opened 8 months ago

mrctrifork commented 8 months ago

Hi I've been through the setup phase of a basic server and when trying to add the html module it seems like it doesn't work.

Hello world program results in error after use(html())


TypeError: $.map is not a function. (In '$.map((X)=>{if(Z)X.$elysiaHookType="global";else X.$elysiaHookType=void 0;return X})', '$.map' is undefined)
nyrdz commented 8 months ago

Looks like it's been fixed in 'main' branch. I got that same issue using the version available on npm. To work with the plugin in the meantime until a new version with a fix is published on npm I did the following: 1) Checked out the repo 2) cd elysia-html; bun install && bun run build && bun link 3) cd to_your_project; bun link @elysiajs/html --save

mrctrifork commented 8 months ago

Thank you for the workaround and the headsup. I'll try this whenever I get the oportunity. In the meantime I have just installed react and rolled out my own SSR with bun. It was transparently easy.

gagangulyani commented 7 months ago

Looks like it's been fixed in 'main' branch. I got that same issue using the version available on npm. To work with the plugin in the meantime until a new version with a fix is published on npm I did the following:

  1. Checked out the repo
  2. cd elysia-html; bun install && bun run build && bun link
  3. cd to_your_project; bun link @elysiajs/html --save

I spent hours figuring out what I was doing wrong, then I found this one, helped me fix my issue! Thanks!

toddheslin commented 7 months ago

Everything was working fine for me on 0.8.0 so if you don't want to do the workaround you could just go: bun add @elysiajs/html@0.8.0