feat(browser-bundle): add IIFE browser bundle for CDN/iframe embedding#469
Open
feat(browser-bundle): add IIFE browser bundle for CDN/iframe embedding#469
Conversation
Adds @openuidev/browser-bundle, a prebuilt IIFE bundle of @openuidev/react-lang + @openuidev/react-ui (plus their runtime deps) and a combined stylesheet, for use in iframe, CDN, and no-build-pipeline contexts (Open WebUI tool plugins, embeddable widgets, CodePen-style demos). Exposes a single stable window.__OpenUI global. Also registers the package in the publish-npm-package workflow so it can be released via the existing manual dispatch flow. Made-with: Cursor
Made-with: Cursor
react-ui's "exports" field doesn't expose "./package.json", so
require.resolve("@openuidev/react-ui/package.json") was falling through
to the "./*" wildcard and mis-resolving to dist/components/package.json,
which broke `prepare` in CI. Resolve the two stylesheets directly via
the declared "./defaults.css" and "./components.css" subpath exports
instead.
Also quote `--define:process.env.NODE_ENV='"production"'` in the build
script so esbuild sees a string literal and properly DCEs React's dev
branches (bundle shrinks from 2.6 MB to 2.2 MB).
Made-with: Cursor
Made-with: Cursor
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.
Summary
@openuidev/browser-bundle: a prebuilt IIFE bundle of@openuidev/react-lang+@openuidev/react-ui(with React, ReactDOM, and all runtime deps inlined) plus a combined stylesheet, intended for iframe, CDN, and no-build-pipeline contexts (Open WebUI tool plugins, embeddable chat widgets, static-site demos, CodePen-style prototypes).window.__OpenUI = { React, createRoot, Renderer, openuiChatLibrary }. Changes to this shape are considered breaking and will bump the major version.esbuildfor the JS bundle + a small Node script that resolves@openuidev/react-uiviacreateRequireand concatenates its two CSS files intodist/openui-styles.css(works regardless of pnpm hoisting).browser-bundleas an option in.github/workflows/publish-npm-package.ymlso it can be released via the existing manual-dispatch flow.For any project with a real build pipeline, consumers should keep using
@openuidev/react-langand@openuidev/react-uidirectly — this package only exists for environments that can't do module resolution.