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/.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 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, },