Closed tzachyrm closed 1 week ago
We were running into the same issue.
Changing our babel config fixed this. This was our old config:
presets: [
[
"@babel/preset-env",
{ modules: "commonjs" },
],
// ...
],
Removing the modules: "commonjs"
part fixed the issue (which now defaults to auto
), but not sure how it affects everything else. Looks like there's an issue with running media-chrome
in a CJS module system.
We're importing some React components, e.g.
In our production build (Webpack, ESM) this works fine, but when using Jest (which uses CJS), we receive the following error:
I've narrowed it down to a single problematic line in
media-chrome/dist/cjs/media-preview-chapter-display.js
:Changing it to
var import_media_text_display = require("./media-text-display.js");
seems to fix the issue, at least in my case.I'm not an expert, but this seems to be an esbuild issue.
media-chrome version: 3.2.1 node version: v18.14.2 jest version: 29.7.0