Skip to content

Commit c871244

Browse files
committed
fix(ui-source-code-editor): prevent Vite from erroring out during the build in React 16/17
Closes: INSTUI-4382
1 parent 304a29a commit c871244

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/ui-source-code-editor/src/SourceCodeEditor/SearchPanel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
144144
dom.style.padding = '8px'
145145
const reactVersionMajor = Number(React.version.split('.')[0])
146146
if (reactVersionMajor >= 18) {
147+
const module = 'react-dom/client'
147148
// webpack tries to evaluate imports compile time which would lead to an error on older react versions
148-
import(/* webpackIgnore: true */ 'react-dom/client')
149+
// Vite errors out during build in React v16/17
150+
import(/* webpackIgnore: true */ /* @vite-ignore */ module)
149151
.then((r) => {
150152
const root = r.createRoot(dom)
151153
root.render(

0 commit comments

Comments
 (0)