Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Fix source maps, error code frames, and other misc items #149

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

rschristian
Copy link
Member

Largely a sync from vite-prerender-plugin -- I'm thinking of moving that into the Preact org (as it's ~60% Preact code anyhow..) to ease maintenance a bit as this ain't great as-is. Could then make it an optional peer dep here (instead of essentially vendoring it), reducing install size for all who aren't using it. That repo has a test suite, not as good as it can be but better than here, which I'm not super excited about mirroring into this repo. Need to think about it anyhow.

Changes:

  • Vite 6 disallows editing most config values from resolvedConfig(), instead, directing users to config() (they might've hinted at this previously but it wasn't enforced). manualChunks is an exception though, can only be set from resolvedConfig() for odd Vite-internal reasons, in case that stands out.
  • Looks like refactor: Clean sourcemaps in newer Vite versions #109 broke the error code frames shortly after I added them. I (foolishly) thought to reuse the loop over the bundle that copies output to our temp dir to strip source maps, but of course, copying occurs before execution... the source maps were therefore unavailable to errors that occured later on when we tried to execute the bundles.
  • pnpm and yalc both broke the "is user code" detection mechanism when parsing the stack trace for an error location as their symlinks don't really match standard node_modules structure. Swapped that out to a singular ID, I don't imagine headless-prerendering will have many false positives.
  • Warns when a prerender run returns nothing
  • Strips source map comments from generated assets too (previously limited to chunks)

@rschristian rschristian merged commit b49447b into main Dec 31, 2024
1 check passed
@rschristian rschristian deleted the refactor/sync-to-vite-prerender-plugin branch December 31, 2024 19:28
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.

2 participants