Conversation
Backport of 3257a97 from next. `jsx: 'preserve'` in optimizeDeps.rolldownOptions.transform was self-defeating: the scanner re-parses the transformed output as plain JS (the js-glob transform force-tags glob-containing modules as moduleType js), so any .tsx with JSX failed with PARSE_ERROR: Unexpected JSX expression, the whole scan aborted and pre-bundling was skipped. The classic runtime lowers JSX to bare React.createElement calls without injecting an import; the scan output is never executed, so the undefined identifier is inert. Verified with a packed tarball against vite 8.3.0 + solid-js 1.9.15: `vite optimize`, the dev server and `vite build` all succeed on a .tsx file that uses import.meta.glob. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 8909380 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #262 on the 2.x line. Backport of 3257a97 (already on
next/@solidjs/vite-plugin3.0.0-next).Problem
For Vite 8+ the plugin set
optimizeDeps.rolldownOptions.transform.jsx: 'preserve'so the Rolldown scanner would not injectreact/jsx-dev-runtimeimports. But the scanner re-parses the transformed output as plain JS (Vite'svite:dep-scan:transform:js-globeven force-tags glob-containing modules asmoduleType: 'js'), so any.tsxwith JSX failed withPARSE_ERROR: Unexpected JSX expression. The whole scan aborted and pre-bundling was skipped:Fix
Use the classic JSX runtime for the scan transform (
jsx: { runtime: 'classic' }). It lowers JSX to bareReact.createElementcalls without injecting any import; the scan output is never executed, it only exists so rolldown can walk the import graph, so the undefined identifier is harmless.Note for anyone testing locally: the string form
jsx: 'classic'(as tried in the issue thread) is not a valid rolldown option and fails withInvalid jsx option. It has to be the object form.Verification
Packed this branch (
pnpm pack) and installed the tarball in a minimal project (vite 8.3.0, solid-js 1.9.15) with a.tsxthat callsimport.meta.globand returns JSX:vite optimize --forceandvite devfail with the parse error above.vite optimize --forcepre-bundlessolid-js, solid-js/web, solid-js/store, solid-js/html, solid-js/h; the dev server serves the file with the glob expanded;vite buildsucceeds.🤖 Generated with Claude Code