Skip to content

Commit

Permalink
fix(log): print more errors
Browse files Browse the repository at this point in the history
  • Loading branch information
KeJunMao committed Oct 24, 2023
1 parent e9c71dc commit 5d72b8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion examples/vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ import Compression from "unplugin-compression/vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [Compression()],
plugins: [Compression({
outDir: 'dist',
adapter: 'tar'
})],
});
6 changes: 3 additions & 3 deletions src/core/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import c from "picocolors";
export class Log {
static log(msg: string) {
console.log(
`${c.inverse(c.bold(c.magenta("UNPLUGIN COMPRESSING")))} ${msg}`
`${c.inverse(c.bold(c.magenta(" UNPLUGIN COMPRESSING ")))} ${msg}`
);
}

static error(msg: string) {
console.log(
`${c.inverse(c.bold(c.red("UNPLUGIN COMPRESSING")))} ${c.red(msg)}`
`${c.inverse(c.bold(c.red(" UNPLUGIN COMPRESSING ")))} ${c.red(msg)}`
);
}

static success(msg: string) {
console.log(
`${c.inverse(c.bold(c.green("UNPLUGIN COMPRESSING")))} ${c.green(msg)}`
`${c.inverse(c.bold(c.green(" UNPLUGIN COMPRESSING ")))} ${c.green(msg)}`
);
}
}
1 change: 1 addition & 0 deletions src/core/unplugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default createUnplugin<Options | undefined>((options) => ({
compressed = await compress(options);
} catch (e) {
Log.error(String(e));
console.error(e)
}
if (compressed) {
Log.success("compressed success");
Expand Down

0 comments on commit 5d72b8c

Please sign in to comment.