From b77dab4ffb0b3fcd3af3cea8523c927b8907788b Mon Sep 17 00:00:00 2001 From: tknickman Date: Wed, 17 Jan 2024 09:42:36 -0500 Subject: [PATCH] feat(bundle): minify in production --- .github/workflows/release.yml | 2 ++ packages/web/{tsup.config.js => tsup.config.ts} | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) rename packages/web/{tsup.config.js => tsup.config.ts} (86%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64787b8..a6b3934 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,9 @@ jobs: if: github.event.release.prerelease == true env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }} + NODE_ENV: production - run: pnpm --filter @vercel/speed-insights publish --no-git-checks if: github.event.release.prerelease == false env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }} + NODE_ENV: production diff --git a/packages/web/tsup.config.js b/packages/web/tsup.config.ts similarity index 86% rename from packages/web/tsup.config.js rename to packages/web/tsup.config.ts index 5506086..170c4b9 100644 --- a/packages/web/tsup.config.js +++ b/packages/web/tsup.config.ts @@ -1,14 +1,16 @@ -import { defineConfig } from 'tsup'; +import { defineConfig, type Options } from 'tsup'; -const cfg = { +const cfg: Options = { splitting: false, sourcemap: true, clean: true, treeshake: false, dts: true, + minify: process.env.NODE_ENV === 'production', format: ['esm', 'cjs'], }; +// eslint-disable-next-line import/no-default-export -- required for tsup export default defineConfig([ { ...cfg,