Skip to content

Commit c210297

Browse files
authored
Update mountReactComponent.js
1 parent 15e932b commit c210297

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nightwatch/commands/mountReactComponent.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,13 @@ module.exports = class Command {
240240
}
241241

242242
static _getReactImports() {
243+
const { version } = require(path.resolve('node_modules', 'react'));
244+
const reactDOMSuffix = version.startsWith('18') ? '/client': '';
245+
243246
return `
244-
import '/node_modules/react/umd/react.development.js';
245-
import '/node_modules/react-dom/umd/react-dom.development.js';
246-
`;
247+
import * as React from 'react';
248+
import * as ReactDOM from "react-dom${reactDOMSuffix}";
249+
`;
247250
}
248251

249252
/**

0 commit comments

Comments
 (0)