feat: improve turbopack compatibility (#11376)

This PR introduces a few changes to improve turbopack compatibility and
ensure e2e tests pass with turbopack enabled

## Changes to improve turbopack compatibility
- Use correct sideEffects configuration to fix scss issues
- Import scss directly instead of duplicating our scss rules
- Fix some scss rules that are not supported by turbopack
- Bump Next.js and all other dependencies used to build payload

## Changes to get tests to pass

For an unknown reason, flaky tests flake a lot more often in turbopack.
This PR does the following to get them to pass:
- add more `wait`s
- fix actual flakes by ensuring previous operations are properly awaited

## Blocking turbopack bugs
- [X] https://github.com/vercel/next.js/issues/76464
  - Fix PR: https://github.com/vercel/next.js/pull/76545
  - Once fixed: change `"sideEffectsDisabled":` back to `"sideEffects":`
  
## Non-blocking turbopack bugs
- [ ] https://github.com/vercel/next.js/issues/76956

## Related PRs

https://github.com/payloadcms/payload/pull/12653
https://github.com/payloadcms/payload/pull/12652
This commit is contained in:
Alessio Gravili
2025-06-02 15:01:07 -07:00
committed by GitHub
parent 2b40e0f21f
commit 319d3355de
167 changed files with 1852 additions and 4673 deletions

View File

@@ -15,12 +15,15 @@ process.env.PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY = 'true'
shelljs.env.DISABLE_LOGGING = 'true'
const prod = process.argv.includes('--prod')
process.argv = process.argv.filter((arg) => arg !== '--prod')
if (prod) {
process.env.PAYLOAD_TEST_PROD = 'true'
shelljs.env.PAYLOAD_TEST_PROD = 'true'
}
const turbo = process.argv.includes('--turbo')
process.argv = process.argv.filter((arg) => arg !== '--prod' && arg !== '--turbo')
const playwrightBin = path.resolve(dirname, '../node_modules/.bin/playwright')
const testRunCodes: { code: number; suiteName: string }[] = []
@@ -122,6 +125,10 @@ function executePlaywright(
spawnDevArgs.push('--prod')
}
if (turbo) {
spawnDevArgs.push('--turbo')
}
process.env.START_MEMORY_DB = 'true'
const child = spawn('pnpm', spawnDevArgs, {