node-server icon indicating copy to clipboard operation
node-server copied to clipboard

Build step

Open cdtut opened this issue 2 years ago • 4 comments

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.

cdtut avatar Nov 16 '23 01:11 cdtut

@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.

yusukebe avatar Nov 16 '23 06:11 yusukebe

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 😎

carlos-duran avatar Nov 23 '23 17:11 carlos-duran

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.

yusukebe avatar Nov 27 '23 05:11 yusukebe

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

sureshbala avatar Aug 16 '24 05:08 sureshbala