ctrl-freaks/freezeframe.js

[ReactFreezeframe] Jest import issue - Cannot use import statement outside a module

Closed this issue · 5 comments

steoo commented

While running jest tests are failing because of this error, does anyone has the same issue?

SyntaxError: Cannot use import statement outside a module

  1 | import React, { Component, Fragment } from 'react';
> 2 | import ReactFreezeframe from 'react-freezeframe';
    | ^
  3 | import PropTypes from 'prop-types';
  4 | import classnames from 'classnames';

@steoo I have this issue as well. Any workarounds?

Actually I get SyntaxError: Unexpected identifier for the same line.

I also had this issue, but adding this to my package.json in the jest settings worked:

    "transformIgnorePatterns": [
      "<rootDir>/node_modules/(?!(freezeframe|react-freezeframe))"
    ]

this is just a matter of properly configuring your jest config, closing