Skip to content

Commit 8bf5b15

Browse files
authored
Ensure that peer deps are externalized (#325)
* Ensure that peer deps are externalized * Upgrade the ubuntu image in the CI due to brownout
1 parent f8ea8bf commit 8bf5b15

5 files changed

Lines changed: 17 additions & 5 deletions

File tree

.changeset/nine-rats-judge.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@slashid/react": patch
3+
---
4+
5+
Properly externalize deps

.github/workflows/bundle-size.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
bundle-size:
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-22.04
1010
strategy:
1111
matrix:
1212
node-version: [20.9.0]

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-22.04
1212
container: "mcr.microsoft.com/playwright:v1.42.1-jammy"
1313
strategy:
1414
matrix:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
release:
1313
name: Release
1414
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-22.04
1616
steps:
1717
- uses: actions/checkout@v3
1818
- uses: pnpm/action-setup@v2

packages/react/vite.config.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { resolve } from "node:path";
22
import { defineConfig } from "vite";
33
import { config } from "./vite.shared";
44

5+
import * as packageJson from "./package.json";
6+
57
export default defineConfig({
68
...config,
79
build: {
@@ -11,8 +13,13 @@ export default defineConfig({
1113
fileName: `main`,
1214
},
1315
rollupOptions: {
14-
// these must appear exactly as imported => having react here won't prevent react/jsx-runtime being bundled, so it must be explicit
15-
external: ["react", "react/jsx-runtime", "react-dom", "react-dom/client"],
16+
external: [
17+
// include all the keys from peerDependencies by default
18+
...Object.keys(packageJson.peerDependencies),
19+
// these must be specified explicitly as they are not matched by react and react-dom from peer deps
20+
"react/jsx-runtime",
21+
"react-dom/client",
22+
],
1623
},
1724
sourcemap: true,
1825
},

0 commit comments

Comments
 (0)