Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false # Continue other combos even if one fails
matrix:
node: [20, 22, 24]
react: ["18.2.0"] # TODO: Add "19.2.1" when ready
react: ["18.2.0", "19.2.3"]

steps:
- name: "Checkout"
Expand Down
8 changes: 4 additions & 4 deletions packages/pages-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
},
"scripts": {
"dev": "pnpm run storybook",
"build": "tsc && vite build",
"build:tsup": "tsup && pnpm build:css",
"build:vite": "tsc && vite build",
"build": "tsup && pnpm build:css",
"build:css": "lightningcss --minify --bundle --targets \">= 0.25%\" src/index.css -o dist/index.css",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
Expand All @@ -49,8 +49,8 @@
"peerDependencies": {
"lexical": "~0.38.2",
"mapbox-gl": "^2.9.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^18.2.0 || ^19.2.3",
"react-dom": "^18.2.0 || ^19.2.3"
},
"devDependencies": {
"@playwright/test": "^1.55.1",
Expand Down
2 changes: 0 additions & 2 deletions packages/pages-components/src/components/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
@import "./analytics/debugger.css";
@import "./hours/hoursTable.css";
@import "./map/map.module.css";
@import "./richText/default-styling.module.css";
@import "./richText/lexical.module.css";
19 changes: 0 additions & 19 deletions packages/pages-components/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,6 @@ export default defineConfig({
".tsx": "tsx",
},

// A note for future maintainers:
// We cannot use tsup until we drop support for React 17. Building with Vite
// handles the React runtime automatically, adjusting imports to use the classic
// runtime when necessary.

// Swapping to tsup results in errors like:
// Error [ERR_MODULE_NOT_FOUND]: Cannot find module '../node_modules/react/jsx-runtime'
// imported from ../node_modules/@yext/pages-components/dist/index.js
// Did you mean to import "react/jsx-runtime.js"?

// We can get around this by setting "jsx":"react" in tsconfig.json (which builds with
// the classic runtime), and requires adding `import React from "react";` to every necessary .tsx file.
// With "jsx":"react-jsx", this import is not necessary. However, other dependencies
// are not automatically adjusted to the classic runtime like Vite does, leading to
// the same error but for other packages, such as lexical.

// Ideally we can switch to tsup because the bundle size is vastly smaller:
// ~710kB for Vite compared to ~85kB for tsup.

// Production mode (strips dev internals)
env: {
NODE_ENV: "production",
Expand Down
8 changes: 7 additions & 1 deletion packages/pages-components/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ export default defineConfig(() => ({
formats: ["es"] as LibraryFormats[], // typescript is unhappy without this forced type definition
},
rollupOptions: {
external: ["react", "react-dom", "mapbox-gl"],
external: [
"react",
"react-dom",
"mapbox-gl",
"react/jsx-runtime",
"react/jsx-dev-runtime",
],
output: {
globals: {
react: "React",
Expand Down
Loading
Loading