Build refactoring
All checks were successful
Lint / lint (push) Successful in 41s

This commit is contained in:
Julien Valverdé
2025-09-20 03:19:45 +02:00
parent 6ac3863af9
commit 99a3fadc3a
8 changed files with 154 additions and 43 deletions

View File

@@ -5,12 +5,11 @@
"type": "module",
"scripts": {
"lint:tsc": "tsc --noEmit",
"bun:dev": "NODE_ENV=development bun --hot ./src/entrypoint.bun.ts",
"bun:build": "esbuild ./src/entrypoint.bun.ts --outdir=./dist --bundle --minify --format=esm --sourcemap --platform=node",
"bun:start": "NODE_ENV=production bun ./dist/entrypoint.bun.js",
"node:dev": "NODE_ENV=development tsx --watch ./src/entrypoint.node.ts",
"node:build": "esbuild ./src/entrypoint.node.ts --outdir=./dist --bundle --minify --format=esm --sourcemap --platform=node",
"node:start": "NODE_ENV=production node --enable-source-maps ./dist/entrypoint.node.js",
"build": "rollup -c",
"dev:bun": "NODE_ENV=development bun --hot ./src/entrypoint.bun.ts",
"dev:node": "NODE_ENV=development tsx --watch ./src/entrypoint.node.ts",
"start:bun": "NODE_ENV=production bun ./dist/entrypoint.bun.js",
"start:node": "NODE_ENV=production node --enable-source-maps ./dist/entrypoint.node.js",
"clean:dist": "rm -rf dist",
"clean:modules": "rm -rf node_modules"
},
@@ -29,7 +28,10 @@
"effect": "^3.17.13"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^16.0.1",
"esbuild": "^0.25.9",
"rollup": "^4.52.0",
"rollup-plugin-esbuild": "^6.2.1",
"tsx": "^4.20.5"
}
}

View File

@@ -0,0 +1,28 @@
import { nodeResolve } from "@rollup/plugin-node-resolve"
import path from "node:path"
import url from "node:url"
import { defineConfig } from "rollup"
import esbuild from "rollup-plugin-esbuild"
const __relativeDirname = path.relative(".", url.fileURLToPath(new URL(".", import.meta.url)))
export default defineConfig({
input: {
"entrypoint.bun": path.join(__relativeDirname, "src", "entrypoint.bun.ts"),
"entrypoint.node": path.join(__relativeDirname, "src", "entrypoint.node.ts"),
},
output: {
dir: path.join(__relativeDirname, "dist"),
format: "es",
sourcemap: true,
},
external: id => !/^[./]/.test(id) && !/^@website\//.test(id),
plugins: [
nodeResolve(),
esbuild({ minify: true }),
],
})