When using React 18 + Jest I get SyntaxError: Cannot use import statement outside a module

Viewed 27

I have small component which uses OpenLayers 7.1 and I have this there:

import Map from "ol/Map";

When trying to run tests using jest (and jest-ts & co) I get:

   /Users/jtiai/Code/react-openlayers/.yarn/cache/ol-npm-7.1.0-d92c823b1e-0935be63be.zip/node_modules/ol/Map.js:4
    import BaseObject from './Object.js';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      1 | import React from "react";
      2 | import { Box } from "@mui/material";
    > 3 | import Map from "ol/Map";
        | ^
      4 |

What config I am missing?

0 Answers
Related