From 23a44831d4d7a94d1b7e6cb45fef36b3ce4fd7d2 Mon Sep 17 00:00:00 2001 From: ikovic Date: Tue, 1 Apr 2025 16:29:48 +0200 Subject: [PATCH 1/2] Ensure that peer deps are externalized --- .changeset/nine-rats-judge.md | 5 +++++ packages/react/vite.config.ts | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/nine-rats-judge.md diff --git a/.changeset/nine-rats-judge.md b/.changeset/nine-rats-judge.md new file mode 100644 index 00000000..6ada558a --- /dev/null +++ b/.changeset/nine-rats-judge.md @@ -0,0 +1,5 @@ +--- +"@slashid/react": patch +--- + +Properly externalize deps diff --git a/packages/react/vite.config.ts b/packages/react/vite.config.ts index 83063854..ff56f128 100644 --- a/packages/react/vite.config.ts +++ b/packages/react/vite.config.ts @@ -2,6 +2,8 @@ import { resolve } from "node:path"; import { defineConfig } from "vite"; import { config } from "./vite.shared"; +import * as packageJson from "./package.json"; + export default defineConfig({ ...config, build: { @@ -11,8 +13,13 @@ export default defineConfig({ fileName: `main`, }, rollupOptions: { - // these must appear exactly as imported => having react here won't prevent react/jsx-runtime being bundled, so it must be explicit - external: ["react", "react/jsx-runtime", "react-dom", "react-dom/client"], + external: [ + // include all the keys from peerDependencies by default + ...Object.keys(packageJson.peerDependencies), + // these must be specified explicitly as they are not matched by react and react-dom from peer deps + "react/jsx-runtime", + "react-dom/client", + ], }, sourcemap: true, }, From 9beac19dcd5bc1b31b83c38121a55eda4f604369 Mon Sep 17 00:00:00 2001 From: ikovic Date: Tue, 1 Apr 2025 16:37:03 +0200 Subject: [PATCH 2/2] Upgrade the ubuntu image in the CI due to brownout --- .github/workflows/bundle-size.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml index d295ad8e..b8fccf1b 100644 --- a/.github/workflows/bundle-size.yml +++ b/.github/workflows/bundle-size.yml @@ -6,7 +6,7 @@ on: jobs: bundle-size: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: node-version: [20.9.0] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fefa0e3..a61c8897 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 container: "mcr.microsoft.com/playwright:v1.42.1-jammy" strategy: matrix: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da57e594..e7f38e4a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: release: name: Release if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2