Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ async function build() {
format: "esm"
})

await Promise.all(
getElements().map((element) =>
esbuild.build({
...sharedConfig,
entryPoints: [`src/components/${element}/${element}.ts`],
minifyWhitespace: true,
outfile: `dist/components/${element}/${element}.js`,
format: "esm",
})
)
)

const result = await esbuild.build({
...sharedConfig,
minifyWhitespace: true,
Expand All @@ -43,4 +55,10 @@ async function build() {
}
}

function getElements() {
return fs.readdirSync("src/components").filter((file) => {
return fs.statSync(`src/components/${file}`).isDirectory()
})
}

await build()