简体   繁体   中英

serverless create-react-app - ReferenceError: regeneratorRuntime is not defined

I used create-react-app and linked it to easybase.io with a premium subscription. It compiles perfectly in my local server. But once I try to deploy it through Netlify with my own domain I get:

● Test suite failed to run

    ReferenceError: regeneratorRuntime is not defined

      2 | import '../App.css'
      3 | import { useEffect, useState } from 'react';
    > 4 | import { useEasybase } from 'easybase-react';
        | ^
      5 |
      6 | function Project() {
      7 |

      at node_modules/easybase-react/node_modules/react-native-storage/lib/storage.esm.js:1:5726
      at Object.<anonymous> (node_modules/easybase-react/node_modules/react-native-storage/lib/storage.esm.js:1:10104)
      at Object.<anonymous> (node_modules/easybase-react/dist/index.js:1:102)
      at Object.<anonymous> (src/pages/Project.js:4:1)
      at Object.<anonymous> (src/App.js:4:1)
      at Object.<anonymous> (src/App.test.js:2:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        4.645 s

My App.test.js file looks like this:

import App from './App';

test('renders learn react link', () => {
  render(<App />);
  const linkElement = screen.getByText(/learn react/i);
  expect(linkElement).toBeInTheDocument();
});

And package.json like this:

  "name": "victor-portfolio",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.11.4",
    "@material-ui/icons": "^4.11.2",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "easybase-react": "^2.2.6",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Ive tried using certain plugins like @bable/plugin-transform-modules-commonjs which I believe come installed already. However, I have been able to solve the issue. I believe is an issue regarding yarn build. But I'm not 100% sure. Any help is appreciated!

there appears to be an issue with some automated testing that is going on. Here's two options to solve this:

1. Update to the latest version of easybase-react, which ports the dependency causing the error – npm install easybase-react@2.2.7

Or

2. Delete App.test.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM