Skip to content

refactor: adopt Turbopack as default bundler#17906

Merged
pettinarip merged 17 commits into
devfrom
refactor/turbopack-adoption
Apr 28, 2026
Merged

refactor: adopt Turbopack as default bundler#17906
pettinarip merged 17 commits into
devfrom
refactor/turbopack-adoption

Conversation

@pettinarip
Copy link
Copy Markdown
Member

@pettinarip pettinarip commented Apr 1, 2026

Summary

Adopts Turbopack as the default bundler. --webpack becomes the opt-out (dev:webpack / build:webpack kept as fallback). Along the way, fixes several patterns that didn't survive Turbopack's stricter module graph and file tracer.

What's in this PR

Default bundler flip

  • dev / build scripts drop --webpack.
  • @next/bundle-analyzer removed (webpack-only).
  • Contributors drops !!raw-loader! inline syntax.
  • Sentry: dropped webpack-only treeshake.removeDebugLogging; silenced dev-time debug logging.

Turbopack-specific fixes

  • Tutorial MDX loader: replaced await import('.../${locale}/${slug}/index.md') with fs.readFile(). Turbopack statically registers every template match (~143k candidate modules), which froze pnpm dev.
  • Path constants in the MDX pipeline: Turbopack's file tracer does not fold cross-module string constants, so join(CONTENT_DIR, ...slug) traces ~4× wider than join("public/content", ...slug). Inlined at hot sites; residual warnings silenced via turbopack.ignoreIssue. See docs/solutions/build-errors/turbopack-file-tracer-doesnt-fold-cross-module-string-constants.md so this isn't reverted later.

Contributors + Staking refactor

  • Contributors is now a server-only component that reads .all-contributorsrc directly, strips unused fields, and shuffles once per SSG build. Deletes the all-contributors.json duplicate (it was already drifting from the bot-maintained source).
  • /staking converted from a client component to a server component (getTranslations instead of useTranslation). StakingHierarchy explicitly marked "use client".

Behavior changes

  • Contributors list renders in SSR HTML (no empty-then-filled hydration flicker). Shuffle order changes per deploy rather than per visit.
  • .all-contributorsrc (bot-maintained) is the single source of truth. No possibility of drift.

Test plan

  • pnpm dev starts with Turbopack
  • pnpm build succeeds with Turbopack
  • pnpm build:webpack still works as fallback
  • pnpm build-storybook succeeds
  • Netlify deploy preview builds
  • Contributors, staking pages render
  • Sentry source-map upload completes

Known gaps / follow-ups (not in this PR)

  • public/content/** mixes static assets and source markdown, which forces the file tracer to consider ~200k files in scope. Moving content/ out of public/ (or migrating to a proper content layer like Contentlayer/Velite) would eliminate most of the Turbopack band-aids in this PR. Bigger effort; worth scoping separately.
  • turbopack.ignoreIssue config. Cosmetic suppression of "Overly broad patterns" warnings that outputFileTracingExcludes already prevents from over-bundling. Would go away with the content-pipeline migration above.

@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
@pettinarip pettinarip force-pushed the refactor/turbopack-adoption branch 2 times, most recently from 4ea54fc to a5c552f Compare April 13, 2026 08:59
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 13, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 00ed4ad
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/69f088f474292b0008ae5605
😎 Deploy Preview https://deploy-preview-17906.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 74 (🟢 up 25 from production)
Accessibility: 93 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (🔴 down 1 from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Base automatically changed from refactor/tailwind-v4-migration to dev April 21, 2026 15:03
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 a5c552f to 5f1aae5 Compare April 22, 2026 18:07
- Narrow second turbopack.ignoreIssue rule to **/src/lib/** (was **)
  so it doesn't mute legitimate NFT warnings elsewhere.
- Sentry debug: opt-in via SENTRY_DEBUG=true instead of hardcoded false
  (still off by default because OTel instrumentation is too noisy in dev).
- Extract ContributorsView (pure render) + restore Contributors stories
  for Chromatic coverage. index.tsx stays server-only.
- Document the plain <img> trade-off and the target="_blank" parity
  with the original InlineLink wrapper.
Auto-merge from prior dev merge had prettier-plugin-tailwindcss re-sort
utility classes in files the branch didn't intend to modify.
@github-actions github-actions Bot added the documentation 📖 Change or add documentation label Apr 27, 2026
@pettinarip pettinarip marked this pull request as ready for review April 27, 2026 07:52
Copy link
Copy Markdown
Collaborator

@myelinated-wackerow myelinated-wackerow left a comment

Choose a reason for hiding this comment

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

LGTM. Few nice-to-haves:

  • TRANSLATIONS_DIR in src/lib/constants.ts looks orphaned now that translationRegistry.ts inlines the literal — please double-check and remove if confirmed unused
  • Nit on ContributorsView: className="h-[132px] w-[132px]" could just be size-[132px], and the width={132} height={132} attrs were only required for next/image — the plain <img> doesn't need them unless I'm missing a CLS reason

- Remove orphaned TRANSLATIONS_DIR export from src/lib/constants.ts
  (translationRegistry now inlines the literal; no remaining importers)
- ContributorCard <img>: use size-[132px] shorthand and drop
  width/height attrs that were holdovers from next/image
@pettinarip
Copy link
Copy Markdown
Member Author

@myelinated-wackerow thanks for the review!

TRANSLATIONS_DIR in src/lib/constants.ts looks orphaned now that translationRegistry.ts inlines the literal — please double-check and remove if confirmed unused

Confirmed orphaned (no imports anywhere in src/ or app/; the only other TRANSLATIONS_DIR matches were local constants defined inside .markdownlint-rules/*.js, which never imported from @/lib/constants). Removed the export.

Nit on ContributorsView: className="h-[132px] w-[132px]" could just be size-[132px], and the width={132} height={132} attrs were only required for next/image — the plain <img> doesn't need them unless I'm missing a CLS reason

You weren't missing anything — it's a plain <img>. Switched to size-[132px] and dropped the width/height holdovers. The class still reserves the box, so CLS is unchanged.

Both addressed in 00ed4ad.

@pettinarip pettinarip merged commit e785508 into dev Apr 28, 2026
9 checks passed
@pettinarip pettinarip deleted the refactor/turbopack-adoption branch April 28, 2026 10:53
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 documentation 📖 Change or add documentation tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants