-
-
Notifications
You must be signed in to change notification settings - Fork 659
Add react/jsx-runtime to external in rolldownOptions #3522
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
Open
alanpoulain
wants to merge
1
commit into
shipshapecode:main
Choose a base branch
from
alanpoulain:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: shipshapecode/shepherd
Length of output: 20678
🏁 Script executed:
Repository: shipshapecode/shepherd
Length of output: 952
🏁 Script executed:
Repository: shipshapecode/shepherd
Length of output: 5528
🏁 Script executed:
Repository: shipshapecode/shepherd
Length of output: 165
🌐 Web query:
Vite 8 build.lib external output.globals UMD rolldownOptions official documentation💡 Result:
In Vite 8, the underlying bundler has transitioned from Rollup to Rolldown [1][2]. Consequently, configuration options previously under
build.rollupOptionshave been migrated tobuild.rolldownOptions[3][4]. For building libraries with UMD support in Vite 8, you must configure your external dependencies and their corresponding global variable mappings within thebuild.rolldownOptionsobject [1]. Configuration Approach: 1. External Dependencies: Usebuild.rolldownOptions.externalto specify dependencies that should not be bundled (e.g., peer dependencies) [1][5]. 2. Global Variable Mapping: For UMD/IIFE formats, theoutput.globalsoption is used to map these external module identifiers to their corresponding global variable names (e.g., 'react' maps to 'React') [6][1]. 3. Rolldown-Specific Handling: Because Rolldown treats externalrequire()calls differently than Rollup, you may need to use theesmExternalRequirePlugin(imported fromvite) in your plugins array if your project relies on externalizing modules that are dynamically required [1]. Example Configuration (vite.config.js): import { defineConfig, esmExternalRequirePlugin } from 'vite'; export default defineConfig({ plugins: [ esmExternalRequirePlugin({ external: ['react', 'react-dom'], }), ], build: { lib: { entry: 'src/main.js', name: 'MyLib', // Required for UMD formats: ['es', 'umd'], }, rolldownOptions: { external: ['react', 'react-dom'], output: { globals: { react: 'React', 'react-dom': 'ReactDOM', }, }, }, }, }); Note that whilebuild.rollupOptionsis currently supported as a deprecated alias for backward compatibility, it is recommended to transition tobuild.rolldownOptions[1][3][4]. Additionally, theglobalsconfiguration only applies toumdandiifeoutput formats and will be ignored foresorcjsbuilds [7][1]. Ensure you also include any necessary sub-path imports (likereact/jsx-runtime) in both yourexternallist andglobalsmap if your build process utilizes them [1].Citations:
🏁 Script executed:
Repository: shipshapecode/shepherd
Length of output: 3259
🌐 Web query:
React 19 UMD builds react/jsx-runtime ReactJSXRuntime global official💡 Result:
React 19 does not provide official UMD builds, including UMD builds for react/jsx-runtime [1][2][3]. As part of the release, the React team officially removed UMD support to reduce build complexity and encourage the use of modern ESM-based alternatives [1][2][4]. Because there is no official UMD build, there is no official global variable for the JSX runtime (such as ReactJSXRuntime) in React 19 [1][2]. If you require UMD-like behavior for loading React 19 via script tags, the official recommendation is to use an ESM-based CDN such as esm.sh, which allows you to import React as an ESM module directly in the browser [1][3]: <script type="module"> import React from "https://esm.sh/react@19/?dev"; import ReactDOMClient from "https://esm.sh/react-dom@19/client?dev"; //... </script> While third-party community projects (such as umd-react [5] or react-umd [6]) exist to provide UMD bundles for React 19, these are not maintained or supported by the official React team [5][6][7]. Furthermore, note that React 19 also removed the global JSX namespace (previously accessible as JSX.Element) [8][9]. In React 19, you should instead access JSX types via the React namespace, such as React.JSX.Element, to ensure compatibility [8][10][9].
Citations:
🏁 Script executed:
Repository: shipshapecode/shepherd
Length of output: 3240
Remove UMD output or provide a React-19-compatible runtime.
The TSX entry uses
react/jsx-runtime, and the package publishesdist/index.umd.cjswhile supporting React 19. React 19 provides no official UMD JSX-runtime global, so adding aReactJSXRuntimemapping is not sufficient. Remove UMD frombuild.lib.formatsand update the package entry points, or bundle and test a compatible runtime.🤖 Prompt for AI Agents
Source: MCP tools