Adding ability to specify entrypoint.

This commit is contained in:
mike12345567 2023-04-27 17:08:59 +01:00
parent de51364303
commit 91c1aaffa7
1 changed files with 6 additions and 2 deletions

View File

@ -11,8 +11,12 @@ const sveltePlugin = require("esbuild-svelte")
const { default: NodeResolve } = require("@esbuild-plugins/node-resolve")
const entry = process.argv[2] || "./src/index.ts"
const outfile = `dist/${entry.split("/").pop().replace(".ts", ".js")}`
console.log(`Building from ${entry} to ${outfile}`)
const sharedConfig = {
entryPoints: [`./src/index.ts`],
entryPoints: [entry],
bundle: true,
minify: true,
tsconfig: `tsconfig.build.json`,
@ -37,7 +41,7 @@ const sharedConfig = {
build({
...sharedConfig,
platform: "node",
outfile: "dist/index.js",
outfile,
}).then(() => {
glob(`${process.cwd()}/src/**/*.hbs`, {}, (err, files) => {
for (const file of files) {