Skip to content

Commit

Permalink
chore: add esbuild-server
Browse files Browse the repository at this point in the history
  • Loading branch information
zugdev committed Dec 4, 2024
1 parent 3b8b932 commit f5e4bb7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 16 additions & 0 deletions build/esbuild-server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import esbuild from "esbuild";
import { esBuildContext } from "./esbuild-build";
(async () => {
await server();
})().catch((error) => {
console.error("Unhandled error:", error);
process.exit(1);
});
export async function server() {
const _context = await esbuild.context(esBuildContext);
const { port } = await _context.serve({
servedir: "static",
port: 8080,
});
console.log(`http://localhost:${port}`);
}
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"node": ">=20.10.0"
},
"scripts": {
"start": "run-p start-wrangler watch",
"start-wrangler": "npx wrangler pages dev static --port 8080",
"watch": "tsx build/esbuild-watch.ts",
"start": "tsx build/esbuild-server.ts",
"build": "tsx build/esbuild-build.ts",
"format": "run-s format:lint format:prettier format:cspell",
"format:lint": "eslint --fix .",
Expand Down

0 comments on commit f5e4bb7

Please sign in to comment.