Skip to content

Module parse failed: Unexpected token for the act-compat.js #1298

Closed
@YevheniiaChursina

Description

@YevheniiaChursina
  • @testing-library/react version: 14.3.0 and above
  • Testing Framework and version: jest: ^29.7.0
  • DOM Environment: jest-environment-jsdom: ^29.7.0
  • node: v18.17.0
  • react: ^18.2.0
  • @storybook/react: "^6.4.19",

What you did:

Updating to version 14.3.0 and above causes the error

What happened:

ERR! /vercel/path0/node_modules/@testing-library/react/dist/act-compat.js 13:28
ERR! Module parse failed: Unexpected token (13:28)
ERR! You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
ERR! | function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
ERR! | function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
ERR! > const reactAct = React.act ?? DeprecatedReactTestUtils.act;
ERR! | function getGlobalThis() {
ERR! |   /* istanbul ignore else */
ERR!  @ /vercel/path0/node_modules/@testing-library/react/dist/pure.js 58:41-64
ERR!  @ /vercel/path0/node_modules/@testing-library/react/pure.js

Problem description:

Updating @testing-library/react to version 14.3.0 and above causes the error and fails the storybook build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions