Skip to content

Commit

Permalink
fix(ui-source-code-editor): prevent Vite from erroring out during the…
Browse files Browse the repository at this point in the history
… build in React 16/17

Closes: INSTUI-4382
  • Loading branch information
ToMESSKa committed Nov 28, 2024
1 parent 304a29a commit c871244
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
dom.style.padding = '8px'
const reactVersionMajor = Number(React.version.split('.')[0])
if (reactVersionMajor >= 18) {
const module = 'react-dom/client'
// webpack tries to evaluate imports compile time which would lead to an error on older react versions
import(/* webpackIgnore: true */ 'react-dom/client')
// Vite errors out during build in React v16/17
import(/* webpackIgnore: true */ /* @vite-ignore */ module)
.then((r) => {
const root = r.createRoot(dom)
root.render(
Expand Down

0 comments on commit c871244

Please sign in to comment.