Skip to content

refactor: adopt Turbopack as default bundler#17906

Draft
pettinarip wants to merge 8 commits intorefactor/tailwind-v4-migrationfrom
refactor/turbopack-adoption
Draft

refactor: adopt Turbopack as default bundler#17906
pettinarip wants to merge 8 commits intorefactor/tailwind-v4-migrationfrom
refactor/turbopack-adoption

Conversation

@pettinarip
Copy link
Copy Markdown
Member

Summary

  • Removes --webpack flag from dev and build scripts — Turbopack is now the default bundler
  • Removes @next/bundle-analyzer (webpack-only, inert under Turbopack)
  • Replaces !!raw-loader! import in Contributors with standard JSON import
  • Fixes Turbopack-specific issues: dynamic import()fs.readFile() for tutorial markdown, file-tracing suppression, Sentry debug logging cleanup

Keeps build:webpack and dev:webpack as fallback scripts.

Stack

Test plan

  • pnpm dev starts with Turbopack (no --webpack)
  • pnpm build succeeds with Turbopack
  • pnpm build:webpack still works as fallback
  • pnpm build-storybook succeeds
  • Contributors page renders correctly (JSON import replacing raw-loader)
  • Sentry source map upload completes post-build
  • Netlify deploy preview builds successfully
  • Bundle sizes within Netlify function limits (compare Turbopack vs webpack output)
  • No 404s on static MDX content pages

@github-actions github-actions bot added config ⚙️ Changes to configuration files dependencies 📦 Changes related to project dependencies tooling 🔧 Changes related to tooling of the project labels Apr 1, 2026
@pettinarip pettinarip force-pushed the refactor/tailwind-v4-migration branch from ed78066 to d61e4e6 Compare April 10, 2026 11:58
Run npx storybook@9 upgrade with automigrations:
- upgrade-storybook-related-dependencies
- initial-globals (globals → initialGlobals)
- consolidated-imports (@storybook/* → storybook/*)
- remove-addon-interactions (moved to core)
- renderer-to-framework (@storybook/react → @storybook/nextjs)
- remove-essential-addons (replaced with @storybook/addon-docs)
- remove-docs-autodocs (deprecated config removed)
Run npx storybook@latest upgrade with automigrations:
- addon-globals-api (viewport/backgrounds configuration)
- nextjs-to-nextjs-vite (reverted - staying on webpack per plan)

Reverted the automatic nextjs-vite migration: replaced
@storybook/nextjs-vite with @storybook/nextjs across all files
to keep the webpack-based framework as intended.
- Remove @next/bundle-analyzer and withBundleAnalyzer wrapper
- Swap scripts: dev/build now use Turbopack (default in Next.js 16),
  dev:webpack/build:webpack available as fallbacks
- Replace .all-contributorsrc symlink with JSON copy for Turbopack
  module resolution compatibility
- Add turbopackIgnore comment for dynamic path.join in rehypeImg.ts
- Both `pnpm build` (Turbopack) and `pnpm build:webpack` pass
turbopackIgnore is a magic comment that only works inside dynamic
import() or require() expressions. Placing it inside path.join(),
readFile(), or existsSync() calls has no effect on Turbopack's
module tracing.
Dynamic import() with variable paths caused Turbopack to trace 143k+
markdown files across all locales. fs.readFile() is invisible to
Turbopack's module graph analysis, matching the pattern already used
in import.ts.
@pettinarip pettinarip force-pushed the refactor/turbopack-adoption branch from a0d6df0 to 4ea54fc Compare April 10, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config ⚙️ Changes to configuration files dependencies 📦 Changes related to project dependencies tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant