honojs / node-server

Node.js Server for Hono
https://hono.dev
388 stars 48 forks source link

Build step #97

Open cdtut opened 11 months ago

cdtut commented 11 months ago

Can someone explain how it works that no build step is needed to use JSX in node? In other frameworks build step is needed to turn JSX into js.

yusukebe commented 11 months ago

@cdtut

Actually, you need build steps for your app using Hono's JSX. If you are using the starter template, you don't mind build steps because it uses the tsx which include the esbuild to build.

carlos-duran commented 11 months ago

Hello @yusukebe, I have the same doubt. What I understand from your answer is that the Node.js starter template (with tsx in the start script) can be used for production out of the box, right?

Thank you, Hono is really cool 😎

yusukebe commented 11 months ago

Hi @carlos-duran,

Whether to use [tsx](https://github.com/privatenumber/tsx) in production depends on you. But, I don't recommend it. You can transpile to pure JavaScript files using tsc or esbuild and then run them with the node command.

sureshbala commented 2 months ago

I think the build step needs to be clarified. I have used tsc and followed the steps mentioned in the documentation but unable to run the project for the following reason

tsc converts the files to .js extension but it does not include the .js extension in the relevant import statements.

Please check the screenshot attached. In the screenshot you can see that the index.js file contains imports without .js file extension

Screenshot 2024-08-16 at 11 26 42 AM