@dwidge/buildy
v0.1.8
Published
Simple esbuild with env.
Downloads
30
Readme
@dwidge/buildy
Simple esbuild with filtered env.
Use env-cmd or dotenv/config for .env files, cross-env for package scripts.
usage
pnpm i -D @dwidge/buildy env-cmd http-server
"scripts": {
"dev": "servey src=src/index.tsx env=\"REACT_APP_ REACT_APP_DEV_\" dir=public port=3000",
"build": "buildy src=src/index.tsx env=REACT_APP_ dir=public out=build meta=tmp/meta.json",
"start": "pnpx http-server build -o -p3000"
}
dev server
pnpm dev
dev server with .env.dev file
pnpm env-cmd -f .env.dev pnpm dev
build with .env file and serve static
pnpm env-cmd pnpm build
pnpm start
src/index.tsx
console.log("process.env", process.env);
cli
> REACT_APP_API=http://localhost:4444 OTHER_ENV=12345 pnpm dev
process.env { REACT_APP_API: "http://localhost:4444" }