Skip to content

Commit c1d9bfb

Browse files
ci: conditionally?
1 parent f171d19 commit c1d9bfb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
run: npm i react@${{ matrix.react }} react-dom@${{ matrix.react }}
3636

3737
- name: Run tests on React ${{ matrix.react }}
38-
run: npm test
38+
run: REACT_VERSION=${{ matrix.react }} npm test

public/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import { createRoot } from 'react-dom/client';
43

54
import syntaxHighlighter, { cmVariableContext } from '../src/index';
65

6+
let createRoot;
7+
if (process.env.REACT_VERSION === '18') {
8+
// eslint-disable-next-line global-require
9+
({ createRoot } = require('react-dom/client'));
10+
}
11+
712
const exampleCode = `curl --request POST
813
--url <<url>>
914
--header 'authorization: Bearer 123'

0 commit comments

Comments
 (0)