From 12792d7c1fb1c696f7a701211045db9fa7a6e3a9 Mon Sep 17 00:00:00 2001 From: BeiyanYunyi <14120445+BeiyanYunyi@users.noreply.github.com> Date: Sat, 7 Sep 2024 12:06:31 +0800 Subject: [PATCH 1/3] perf: :zap: properly configure minify options --- .swcrc | 10 ++++++++++ rollup.config.mjs | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .swcrc diff --git a/.swcrc b/.swcrc new file mode 100644 index 0000000..ea627c4 --- /dev/null +++ b/.swcrc @@ -0,0 +1,10 @@ +{ + "$schema": "https://swc.rs/schema.json", + "jsc": { + "minify": { + "compress": true, + "mangle": { "props": {} } + }, + "target": "es2017" + } +} diff --git a/rollup.config.mjs b/rollup.config.mjs index f4ccda9..a279dfe 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -18,7 +18,6 @@ export default defineConfig([ swc.rollup({ minify: true, jsc: { - target: 'esnext', baseUrl: pathResolve('./'), paths: { '@/*': ['./src/*'], From 289622988979cbeec38ea9db2a690988b0df0bbe Mon Sep 17 00:00:00 2001 From: BeiyanYunyi <14120445+BeiyanYunyi@users.noreply.github.com> Date: Sat, 7 Sep 2024 12:21:35 +0800 Subject: [PATCH 2/3] refactor: :fire: no need to resolve --- rollup.config.mjs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index a279dfe..5af2eff 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,5 +1,4 @@ import resolve from '@rollup/plugin-node-resolve'; -import { resolve as pathResolve } from 'node:path'; import { defineConfig } from 'rollup'; import swc from 'unplugin-swc'; @@ -18,7 +17,7 @@ export default defineConfig([ swc.rollup({ minify: true, jsc: { - baseUrl: pathResolve('./'), + baseUrl: import.meta.dirname, paths: { '@/*': ['./src/*'], }, From 49422d8ac9f109aa663c81146c524ba9c83869ec Mon Sep 17 00:00:00 2001 From: BeiyanYunyi <14120445+BeiyanYunyi@users.noreply.github.com> Date: Sat, 7 Sep 2024 20:29:57 +0800 Subject: [PATCH 3/3] fix: :bug: --- .swcrc | 2 +- src/main.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.swcrc b/.swcrc index ea627c4..1a40232 100644 --- a/.swcrc +++ b/.swcrc @@ -3,7 +3,7 @@ "jsc": { "minify": { "compress": true, - "mangle": { "props": {} } + "mangle": true }, "target": "es2017" } diff --git a/src/main.ts b/src/main.ts index 83a5a21..b97e31f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,8 @@ import { Anatolo } from './anatolo/anatolo'; import * as Utils from './utils/main'; +import FloatBtn from './components/float-btn'; (window as any).Anatolo = Anatolo; (window as any).Utils = Utils; -import FloatBtn from './components/float-btn'; new FloatBtn();