Switch to using single-file components (SFC) in Vue
This commit is contained in:
parent
ccdb391ccc
commit
0126d24242
6 changed files with 362 additions and 21 deletions
28
build.js
Normal file
28
build.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import esbuild from "esbuild";
|
||||
import vue from "esbuild-plugin-vue3";
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const watch = args.includes("--watch");
|
||||
const minify = args.includes("--minify");
|
||||
|
||||
const config = {
|
||||
entryPoints: ["ts/main.ts"],
|
||||
bundle: true,
|
||||
format: "esm",
|
||||
outfile: "static/gen/js/bundle.js",
|
||||
plugins: [vue()],
|
||||
define: {
|
||||
__VUE_OPTIONS_API__: "true",
|
||||
__VUE_PROD_DEVTOOLS__: "false",
|
||||
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false",
|
||||
},
|
||||
minify,
|
||||
};
|
||||
|
||||
if (watch) {
|
||||
const ctx = await esbuild.context(config);
|
||||
await ctx.watch();
|
||||
console.log("Watching for changes...");
|
||||
} else {
|
||||
await esbuild.build(config);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue