esbuild - Getting Started

Server Side

Installation:

npm install esbuild --save-dev

Dependencies:

npm install react react-dom --save

Code File:

//app.jsx
import * as React from "react";
import * as Server from "react-dom/server";

const Greet = () => <h1>Hello World!</h1>;
console.log(Server.renderToString(<Greet />));

Now run esbuild:

npx esbuild app.jsx --bundle --outfile=out.js