-
Notifications
You must be signed in to change notification settings - Fork 0
/
esbuild.js
38 lines (33 loc) · 873 Bytes
/
esbuild.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import * as esbuild from "esbuild";
import stylePlugin from "esbuild-style-plugin";
import dotenv from "dotenv";
import { createRequire } from "module";
const require = createRequire(import.meta.url);
dotenv.config({ path: `.env.${process.env.NODE_ENV}` });
let ctx = await esbuild.context({
logLevel: "info",
entryPoints: ["web/src/App.tsx", "web/src/main.scss"],
outdir: "public",
bundle: true,
minify: true,
sourcemap: true,
plugins: [
stylePlugin({
postcss: {
plugins: [require("tailwindcss"), require("autoprefixer")],
},
}),
],
define: {
"process.env.APP_HOST": JSON.stringify(process.env.APP_HOST),
},
});
console.log("⚡ Build complete! ⚡");
if (process.argv.slice(2)[0] === "--watch") {
await ctx.watch();
} else {
await ctx.watch();
setTimeout(async () => {
await ctx.dispose();
}, 1000);
}