From 744e4cd4f42c6654b3bd2426f454fcec8e5e14f1 Mon Sep 17 00:00:00 2001 From: pouriya babaali Date: Sat, 16 Nov 2024 13:47:49 +0330 Subject: [PATCH 1/2] fix: issue with spinner not show and update tsup to accept external libraries as peer dependency to not include inside bundle size --- src/HolyProgress.ts | 3 +-- tsup.config.ts | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/HolyProgress.ts b/src/HolyProgress.ts index 0442a3b..bc41f7d 100644 --- a/src/HolyProgress.ts +++ b/src/HolyProgress.ts @@ -125,10 +125,9 @@ export class HolyProgress { progressBar.style.opacity = '0'; setTimeout(() => { this.removeBarFromDOM(); + this.removeSpinnerFromDOM(); next(); }, this.settings.speed); - - this.removeSpinnerFromDOM(); }, this.settings.speed); } else { setTimeout(next, this.settings.speed); diff --git a/tsup.config.ts b/tsup.config.ts index 683a46b..916ffe2 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,10 +1,20 @@ -import { Options } from 'tsup'; -export const tsup: Options = { - target: 'es6', +import { defineConfig } from "tsup"; +import { peerDependencies } from "./package.json"; + +const externalDependencies = peerDependencies + ? Object.keys(peerDependencies) + : []; + +export default defineConfig({ + entry: ["src/index.tsx"], + format: ["cjs", "esm"], + target: ["es6"], + sourcemap: false, clean: true, dts: true, - entry: ['src/index.tsx'], + external: externalDependencies, + minify: true, + treeshake: true, keepNames: true, - sourcemap: true, - format: ['cjs', 'esm'], -}; + jsxFactory: "automatic", +}); From bea8f2f4ce14a292fccd69df12f283cf869ba68e Mon Sep 17 00:00:00 2001 From: Tom Rumpf <35841182+tomcru@users.noreply.github.com> Date: Sun, 17 Nov 2024 15:09:58 +0100 Subject: [PATCH 2/2] chore: revert this.removeSpinnerFromDOM change This does not fix: https://github.com/tomcru/holy-loader/issues/34 (See my comment) --- src/HolyProgress.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/HolyProgress.ts b/src/HolyProgress.ts index bc41f7d..109b614 100644 --- a/src/HolyProgress.ts +++ b/src/HolyProgress.ts @@ -125,9 +125,10 @@ export class HolyProgress { progressBar.style.opacity = '0'; setTimeout(() => { this.removeBarFromDOM(); - this.removeSpinnerFromDOM(); next(); }, this.settings.speed); + + this.removeSpinnerFromDOM(); }, this.settings.speed); } else { setTimeout(next, this.settings.speed);