-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Maybe ESBuild will be able to build webcomponents after all...? - Removed Qodana btw
- Loading branch information
Showing
5 changed files
with
112 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
import * as esbuild from "esbuild"; | ||
import { minifyTemplates, writeFiles } from "esbuild-minify-templates"; | ||
|
||
const start = process.hrtime.bigint(); | ||
|
||
const ctx = await esbuild.context({ | ||
entryPoints: ["./wwwroot/js/src/**/*.ts", "./wwwroot/js/src/**/*.js"], | ||
const baseSettings = { | ||
minify: true, | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: "./wwwroot/js/dist", | ||
color: true, | ||
logLevel: "info" | ||
}; | ||
|
||
const bundleContext = await esbuild.context({ | ||
...baseSettings, | ||
entryPoints: ["./wwwroot/js/src/**/*.ts", "./wwwroot/js/src/**/*.js"], | ||
outdir: "./wwwroot/js/dist" | ||
}); | ||
|
||
const litContext = await esbuild.context({ | ||
...baseSettings, | ||
entryPoints: ["./wwwroot/js/src-webcomponents/**/*.ts"], | ||
plugins: [minifyTemplates(), writeFiles()], | ||
outdir: "./wwwroot/js/bundle", | ||
write: false | ||
}) | ||
|
||
// perform build | ||
const ctx = process.argv.includes('--wc') ? litContext : bundleContext; | ||
|
||
if (process.argv.includes("--watch")) { | ||
await ctx.watch(); | ||
console.log("Watching files..."); | ||
} else { | ||
await ctx.rebuild(); | ||
await ctx.dispose(); | ||
console.log(`Build completed in ${(process.hrtime.bigint() - start) / BigInt(1_000_000)}ms`); | ||
process.exit(); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters