Skip to content

Commit

Permalink
remove esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
5jiji committed Jul 10, 2024
1 parent 5d71b95 commit 5433ed6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 444 deletions.
15 changes: 1 addition & 14 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as esbuild from "esbuild";
import { readdir, cp as copy, rm as remove, readFile, writeFile } from "node:fs/promises";
import { minify } from "terser";

Expand Down Expand Up @@ -42,25 +41,13 @@ const clientStyle = []; // await getExtFiles("./src/client/css", ".css");
const clientFiles = [];
clientFiles.push(...clientScript.map(v => `./src/client/scripts/${v}`), ...clientStyle.map(v => `./src/client/css/${v}`));

const esbuildResult = await esbuild.build({
entryPoints: clientFiles,
bundle: true,
minify: false, // Disable minification in esbuild
outdir: "dist",
outbase: "src/client",
sourcemap: true,
platform: "browser",
format: "esm",
});

console.log(esbuildResult);

for (const file of clientFiles) {
const filePath = `./dist/${file.replace('./src/client/', '')}`;
const code = await readFile(filePath, 'utf8');
const minified = await minify(code, {
mangle: false, // Disable variable name mangling
compress: true, // Enable compression
sourceMap: true
});

await writeFile(filePath, minified.code, 'utf8');
Expand Down
Loading

0 comments on commit 5433ed6

Please sign in to comment.