Skip to content

Enhance Turbopack support and improve loader functionality (retry)#70

Open
maxblank-stripe wants to merge 1 commit into
mainfrom
revert-69-revert-67-main
Open

Enhance Turbopack support and improve loader functionality (retry)#70
maxblank-stripe wants to merge 1 commit into
mainfrom
revert-69-revert-67-main

Conversation

@maxblank-stripe

@maxblank-stripe maxblank-stripe commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Retries #67 because CI actions were not triggered in the original PR and failed post-merge.

@DeeeeLAN can you try running npm run test -- -u to update jest snapshots if you're working on a windows machine? It doesn't change anything on macos and CI fails for the windows test builds. Thanks!

@DillanCMills

Copy link
Copy Markdown

I primarily use linux and macOS. Let me see if I can find the time to boot windows and get this figured out.

esetnik added a commit to ProdigyEMS/prodigy-documentation-site that referenced this pull request Jul 7, 2026
* feat: build with turbopack via a markdoc loader shim

Removes --webpack from build and dev. @markdoc/next.js 0.5.0's own
Turbopack support is broken three ways: createTurbopackConfig omits
the dir/pagesDir options its loader requires; the loader's bare
schema-specifier resolution fails under Turbopack's compat resolver
and silently produces an empty schema; and it emits absolute-path
imports Turbopack rejects. The upstream fix (markdoc/next.js#67) was
merged then reverted over a Windows CI snapshot failure; the retry
(markdoc/next.js#70) is open.

Until that ships, markdoc-turbopack-loader.js delegates to the
unmodified upstream loader with a Node-based resolver that returns
schema imports relative to each .md file, wired through a hand-written
turbopack.rules entry with the full option set. The webpack config is
stripped from the final Next config (webpack builds no longer compile
.md pages). Remove the shim when @markdoc/next.js >= 0.6.0 lands.

Verified: turbopack build green (29/29 routes, .md pages SSG with
getStaticProps), smoke 200/200/200/404, markdoc content renders, docs
page height matches baseline (9697), dev mode boots on Turbopack and
serves .md pages, lint clean, deliberate server throw captured in
Sentry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NhGWp3geXAjzZ1roRdUDNr

* fix(sentry): server-init fallback + explicit api wrap for netlify turbopack builds

The PR's preview check caught server-side capture silently broken on
the Netlify Lambda with the Turbopack build (local capture works;
verified by markers). Root cause class: the Netlify runtime does not
reliably load instrumentation.js (opennextjs-netlify#3503), and with
Turbopack output the static-import workaround no longer takes effect.

- src/lib/sentry-server-fallback.js: idempotent server-only init
  imported from _app (guards: typeof window, getClient(), DSN present)
- /api/sentry-test explicitly wrapped with wrapApiHandlerWithSentry
  since API routes are not covered by pages/_error and onRequestError
  never registers when instrumentation is skipped

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NhGWp3geXAjzZ1roRdUDNr

* fix(sentry): merge turbopack config instead of clobbering sentry's debugIds flag

Root cause of the unsymbolicated server frames: replacing
finalConfig.turbopack wholesale deleted debugIds: true (Sentry relies
on Turbopack's NATIVE debug-id emission on Next 16 and skips its own
injection when it believes native IDs are active) plus Sentry's
instrumentation rules. Merge only our '*.md' rule instead. Verified:
45 server chunks including the API route chunk now carry //# debugId=
with matching map keys.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NhGWp3geXAjzZ1roRdUDNr

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@esetnik

esetnik commented Jul 7, 2026

Copy link
Copy Markdown

Opened #72 against this branch with the Windows CI fix — the failures were three real cross-platform bugs (emitted import separators, emitted path metadata, and one test's posix-only string replace), so no snapshot updates were needed: the existing snapshots pass on both platforms. Proof runs on my fork: ubuntu+windows green with the fixes vs windows failing without them.

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.

3 participants