axe-core-npm
axe-core-npm copied to clipboard
Uncaught (in promise) TypeError: Cannot set property createElement of [object Module] which has only a getter
Uncaught (in promise) TypeError: Cannot set property createElement of [object Module] which has only a getter at reactAxe (index.js:334)
Product: @axe-core/react
Expectation: shows in console invalidations
Actual: Console shows: index.js:334 Uncaught (in promise) TypeError: Cannot set property createElement of [object Module] which has only a getter at reactAxe (index.js:334) at Module../src/launch-axe.ts (launch-axe.ts:6)
Motivation: I want to have compability with https://cdn.jsdelivr.net/npm/[email protected]/umd/react.production.min.js
axe-core version: 4.2.3
@axe-core/react: 4.2.2
- Node version: v12.21.0
- Platform: Windows
Any updates on this? Getting the same error message Cannot set property createElement of [object Module] which has only a getter
This is for a React 17 + TypeScript 4.4 + Webpack 5 project.
We are currently investigating this issue and will have an update soon!
We managed to get it working by using a default import statement of react/react-dom instead.
Not an ideal solution but is sufficient as a temporary workaround for now.
Before:
import * as React from "react";
import * as ReactDOM from "react-dom"
After:
import React from "react";
import ReactDOM from "react-dom";
Same issue using preact/compat
, but the workaround does not seem to work