Skip to content

Conversation

@dstaley
Copy link
Member

@dstaley dstaley commented May 1, 2025

Description

This PR updates our Next.js App Router template to use Turbopack by default. While this doesn't dramatically decrease the execution time, it does make them slightly faster to run locally.

The improved performance of Turbopack versus Webpack surfaced an issue with how we use signInWithEmailAndInstantPassword in the billing tests. Since we performed a navigation immediately after calling the signIn method, the page was reloaded before the sign-in could be completed. This is because Turbopack was able to response with the HTML for the document request faster than Webpack. This was fixed by adding a new parameter to the method, waitForSession (defaults to true) that will wait for window.Clerk.session to the truthy before resolving the promise.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link

changeset-bot bot commented May 1, 2025

🦋 Changeset detected

Latest commit: c360901

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented May 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 1, 2025 7:37pm

@dstaley dstaley marked this pull request as ready for review May 1, 2025 19:42
.setEnvFormatter('public', key => `NEXT_PUBLIC_${key}`)
.addScript('setup', constants.E2E_NPM_FORCE ? 'pnpm install --force' : 'pnpm install')
.addScript('dev', 'pnpm dev')
.addScript('dev', constants.E2E_NEXTJS_VERSION === '13' ? 'pnpm dev:webpack' : 'pnpm dev')
Copy link
Member Author

Choose a reason for hiding this comment

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

Next.js v13 does not support next dev --turbo.

experimental: {
serverActions: true,
},
outputFileTracingRoot: '/',
Copy link
Member Author

Choose a reason for hiding this comment

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

By default, Turbopack doesn't resolve files outside of the project root. We use pnpm link to install dependencies, which exist outside of the root. We set the outputFileTracingRoot to the root / directory to allow Turbopack to resolve dependency files from anywhere on disk.

@dstaley dstaley changed the title experiment(e2e): Use Turbopack in Next.js app router e2e feat(e2e): Use Turbopack in Next.js app router e2e May 1, 2025
@dstaley dstaley merged commit fbfc5fe into main May 1, 2025
36 of 38 checks passed
@dstaley dstaley deleted the ds.experiment/turbopack-e2e branch May 1, 2025 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants