35 lines
689 B
JavaScript
35 lines
689 B
JavaScript
|
#!/usr/bin/env node
|
||
|
"use strict";
|
||
|
|
||
|
import path from 'path';
|
||
|
|
||
|
import esbuild from 'esbuild';
|
||
|
|
||
|
const __dirname = import.meta.url.slice(7, import.meta.url.lastIndexOf("/"));
|
||
|
|
||
|
(async () => {
|
||
|
"use strict";
|
||
|
|
||
|
const result = await esbuild.build({
|
||
|
entryPoints: [
|
||
|
"./app.mjs",
|
||
|
"./app.css"
|
||
|
].map(filepath => path.resolve(__dirname, filepath)),
|
||
|
outdir: path.resolve(__dirname, "../static-dist"),
|
||
|
bundle: true,
|
||
|
minify: true,
|
||
|
sourcemap: true,
|
||
|
loader: {
|
||
|
".html": "file",
|
||
|
".svg": "file",
|
||
|
".woff2": "file",
|
||
|
".woff": "file",
|
||
|
".eot": "file",
|
||
|
".ttf": "file"
|
||
|
}
|
||
|
});
|
||
|
console.log(result);
|
||
|
|
||
|
// console.log(await esbuild.analyzeMetafile(result.metafile));
|
||
|
})();
|