Skip to content

Fix tyndale-next config export#3

Merged
ogrodev merged 1 commit into
mainfrom
fix-tyndale-next-config-export
May 31, 2026
Merged

Fix tyndale-next config export#3
ogrodev merged 1 commit into
mainfrom
fix-tyndale-next-config-export

Conversation

@ogrodev
Copy link
Copy Markdown
Owner

@ogrodev ogrodev commented May 30, 2026

Summary

  • export tyndale-next/config for both ESM and CommonJS config loaders
  • copy the CommonJS config loader into dist during package builds
  • configure Turbopack aliases for Next.js 16 while keeping an exact webpack alias for webpack builds
  • update the Next.js e2e fixture to use withTyndaleConfig
  • keep Playwright integration CI on LTS Node lines and install only Chromium's headless shell so stale Node 24 browser installs do not block product signal

Closes #2.

Review responses

  • CodeRabbit package build: switched the tyndale-next copy step from node -e to a Bun Bun.write one-liner.
  • CodeRabbit root conditional exports: fixed root export selection in both ESM and CJS config loaders so conditional root exports maps are passed through selectExportPath.

Verification

  • bun test --cwd packages/tyndale-next
  • bun run build:packages
  • bun test tests/e2e/
  • bun run test:playwright
  • bunx playwright install --with-deps --only-shell --dry-run chromium

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tyndale-website Ready Ready Preview, Comment May 31, 2026 12:59pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a CommonJS ./config package export and CJS entry, implements package-entry resolution (exports/module/main fallbacks) for tyndale-react, injects env and bundler aliasing into Next.js config for Turbopack/Webpack, and updates unit/integration tests and fixtures to validate CJS and ESM loading.

Changes

Tyndale Config Export and Resolution

Layer / File(s) Summary
Export declaration and build setup
packages/tyndale-next/package.json
Declares a CommonJS ./config subpath export (dist/config.cjs) and updates the build script to emit dist/config.cjs from src/config.cjs.
CommonJS config module
packages/tyndale-next/src/config.cjs
New CJS entry that reads tyndale.config.json, resolves tyndale-react package entry paths (including nested exports), injects Tyndale env vars into Next config, and sets Turbopack and exact-match Webpack aliases.
TypeScript package resolution & ESM wiring
packages/tyndale-next/src/config.ts
Implements helpers to select exports targets, fallback to module/main, resolve physical paths, convert paths for Turbopack aliases, and wire Turbopack resolveAlias and Webpack exact-match alias (tyndale-react$).
Unit tests: bundler aliasing
packages/tyndale-next/tests/config.test.ts
Adds Turbopack alias assertions and updates webpack tests to expect tyndale-react$ exact-match alias while ensuring the generic tyndale-react key is absent.
Integration tests: subpath export
packages/tyndale-next/tests/exports.test.ts
Adds integration test that scaffolds temporary node_modules (CJS + ESM), spawns Node to load tyndale-next/config in both module systems, invokes config.webpack and inspects config.turbopack.resolveAlias, and asserts env and alias resolution.
E2E fixture update
tests/e2e/fixture/next.config.mjs
Replaces direct tyndale.config.json parsing with nextConfig = withTyndaleConfig({}) to use shared config wiring.
CI change: Playwright install
.github/workflows/portability.yml
Use bunx playwright install --with-deps --only-shell chromium to install Chromium shell only.

Sequence Diagram(s)

sequenceDiagram
  participant NextConfig
  participant withTyndaleConfig
  participant PackageResolver
  participant Filesystem
  participant Turbopack
  participant Webpack

  NextConfig->>withTyndaleConfig: call with {} / existing config
  withTyndaleConfig->>PackageResolver: resolvePackageExport('tyndale-react' and './server')
  PackageResolver->>Filesystem: read package.json and exports
  PackageResolver->>withTyndaleConfig: return resolved physical paths
  withTyndaleConfig->>Turbopack: set resolveAlias entries
  withTyndaleConfig->>Webpack: remove broad alias, set exact-match alias (tyndale-react$)
  withTyndaleConfig->>NextConfig: return augmented config with env and aliases
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I’m a rabbit in the build, nibbling exports with delight,
CJS hopped in beside ESM to make the pathways right,
I traced package.json maps and placed each alias true,
Tests tidy up the meadow so imports find their due,
🐰🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix tyndale-next config export' directly addresses the core issue: enabling the package subpath './config' export that was previously undefined, matching the linked issue #2.
Linked Issues check ✅ Passed The PR directly addresses all coding requirements from issue #2: exports the './config' subpath in package.json for both ESM and CommonJS, implements Turbopack/Webpack alias configuration for Next.js 16 compatibility, and updates the e2e fixture to use withTyndaleConfig.
Out of Scope Changes check ✅ Passed All changes are scoped to the linked issue #2: config export implementation, Next.js integration, Turbopack/Webpack alias setup, and a related Playwright browser installation optimization for CI stability.
Description check ✅ Passed The PR description follows the template structure with a clear summary section, related issue closure, and comprehensive verification steps.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-tyndale-next-config-export

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/tyndale-next/package.json`:
- Line 41: The build script in package.json currently invokes the Node binary
("scripts.build": "tsc && node -e
\"require('node:fs').copyFileSync('src/config.cjs', 'dist/config.cjs')\""),
which breaks when only Bun is installed; change the copy step to a POSIX/copier
command that works under Bun (for example replace the node -e invocation with
"cp src/config.cjs dist/config.cjs") so the script becomes something like "tsc
&& cp src/config.cjs dist/config.cjs"; update the "build" script in
packages/tyndale-next/package.json (scripts.build) accordingly, or alternatively
implement the copy using a Bun-compatible JS one-liner if you need
cross-platform handling.

In `@packages/tyndale-next/src/config.cjs`:
- Around line 53-65: selectPackageEntry currently assumes a non-array
packageJson.exports object is a subpath map and only inspects exports['.'],
which misses conditional-root exports like { "import": "...", "require": "..."
}; change the logic in selectPackageEntry to first try selectExportPath on the
exportsField itself (i.e., call selectExportPath(exportsField)) and if that
returns undefined then fall back to reading exportsField['.'] (and then to
packageJson.module/packageJson.main/'index.js'); reference selectPackageEntry,
selectExportPath, and exportsField when making the change.

In `@packages/tyndale-next/src/config.ts`:
- Around line 87-99: selectPackageEntry currently treats any object-valued
packageJson.exports as a subpath map and unconditionally uses exports['.'],
which breaks root conditional exports; change selectPackageEntry so it checks if
packageJson.exports is an object and hasOwnProperty('.') — if yes use
exports['.'] as rootExport, otherwise pass the entire exports object into
selectExportPath (which already understands conditional maps); apply the same
fix to the mirrored logic in config.cjs and ensure references to
selectExportPath and packageJson.exports are used as described.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: efc4e355-7bc1-4fc3-8788-767d391d898c

📥 Commits

Reviewing files that changed from the base of the PR and between 85aefa3 and 9dd9ca3.

📒 Files selected for processing (6)
  • packages/tyndale-next/package.json
  • packages/tyndale-next/src/config.cjs
  • packages/tyndale-next/src/config.ts
  • packages/tyndale-next/tests/config.test.ts
  • packages/tyndale-next/tests/exports.test.ts
  • tests/e2e/fixture/next.config.mjs

Comment thread packages/tyndale-next/package.json Outdated
Comment thread packages/tyndale-next/src/config.cjs Outdated
Comment thread packages/tyndale-next/src/config.ts Outdated
@ogrodev ogrodev force-pushed the fix-tyndale-next-config-export branch from 7b27449 to 47b7fe9 Compare May 31, 2026 12:59
@ogrodev ogrodev merged commit 40772d2 into main May 31, 2026
16 checks passed
@ogrodev ogrodev deleted the fix-tyndale-next-config-export branch May 31, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: Package subpath './config' is not defined by "exports"

1 participant