Repository navigation
fix: add jsxImportSource to esbuild-loader webpack configs - #906
Merged
Merged
Conversation
JS/JSX projects were getting 'React is not defined' at runtime because esbuild-loader's jsx: 'automatic' mode needs jsxImportSource to know where to import the JSX runtime from. TypeScript projects were fine since esbuild reads jsxImportSource from tsconfig.json, but JS projects have no tsconfig fallback. - webpack.config.js: add jsxImportSource: 'react' alongside jsx: 'automatic' - webpack.config.production.js: add both jsx: 'automatic' and jsxImportSource: 'react' - package.json: expose ./globals subpath in exports map so TypeScript can resolve '@availity/workflow/globals' in tsconfig types[] - example/index.tsx: remove manual 'import React' workaround (no longer needed)
jordan-a-young
requested review from
LauRoxx and
gregmartDOTin
as code owners
September 22, 2026 16:01
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.
Problem
JS/JSX projects using
@availity/workflowgetUncaught ReferenceError: React is not definedat runtime. TypeScript projects are unaffected because esbuild readsjsxImportSourcefromtsconfig.json. JS projects have no tsconfig, so esbuild doesn't know where to import the JSX runtime from despitejsx: 'automatic'being set.Root cause
webpack.config.js(dev): hadjsx: 'automatic'but nojsxImportSourcewebpack.config.production.js: missing bothjsx: 'automatic'andjsxImportSourcevitest.config.js: already correct — had both, no change neededAdditionally,
package.jsonwas missing a./globalsentry in theexportsmap, causing TypeScript to error with "Cannot find type definition file for '@availity/workflow/globals'" when"types": ["@availity/workflow/globals"]was set in a project'stsconfig.json.Changes
webpack.config.js: addjsxImportSource: 'react'to esbuild-loader optionswebpack.config.production.js: addjsx: 'automatic'andjsxImportSource: 'react'to esbuild-loader optionspackage.json: expose./globalssubpath inexportsmap so TypeScript can resolve@availity/workflow/globalsexample/index.tsx: remove manualimport Reactworkaround (no longer needed with the fix in place)tests/__snapshots__/workflowConfigs.spec.js.snap: update snapshots to reflect the new esbuild-loader optionsTesting
All 460 tests pass.