React Failed to compile after call "useMoralis()"'

step 1

import { useMoralis } from "react-moralis";

step 2

const { authenticate, isAuthenticated, user, logout } = useMoralis();
// Failed to compile from call useMoralis above. πŸ€”πŸ€”πŸ€”

step 3

import React from 'react'
import './App.css'
import constant, { System } from './constant'
import { ToastContainer } from 'react-toastify'
import { HashRouter as Router, Switch, Route } from 'react-router-dom'
import { MoralisProvider } from "react-moralis";
import 'react-toastify/dist/ReactToastify.css'

function App() {
  const routeComponents = constant.routers.map(({ url, component }, key) => (
    <Route exact path={url} component={component} key={key} />
  ))
  return (
    <div>

      <MoralisProvider appId={System.APP_ID} serverUrl={System.SERVER_URL}> {/* failed to compile <MoralisProvider> */}
        {/* <Router basename="/aom"> */}
        <Router basename="">
          <Switch>{routeComponents}</Switch>
        </Router>
        <ToastContainer />
      </MoralisProvider>    {/* failed to compile <MoralisProvider> */}
    </div>
  )
}

export default App

Environment :slight_smile:
windows 11
Nodejs v16.13.0
React project created by: React Create App Typescript Version.

I have tested villain HTML to add Moralia that worked well.
but I hope ingredient React-Moralia.

Please help Thank you.

Please share package json

I don’t know what that error means, found something similar on google: https://githubmemory.com/repo/pancakeswap/pancake-swap-interface-v1/issues/424

if you don’t use react-moralis, then everything works fine with your build?

{
  "name": "",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@craco/craco": "^6.4.0",
    "@metamask/detect-provider": "^1.2.0",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^26.0.15",
    "@types/node": "^12.0.0",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "@types/react-router-dom": "^5.3.1",
    "craco-alias": "^3.0.1",
    "rc-slider": "^9.7.4",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^5.3.0",
    "react-scripts": "4.0.3",
    "react-spring": "^9.3.0",
    "react-spring-3d-carousel": "^1.2.1",
    "react-toastify": "^8.0.3",
    "styled-components": "^5.3.1",
    "typescript": "^4.1.2",
    "uuid": "^8.3.2",
    "web-vitals": "^1.0.1",
    "web3": "^1.6.0",
    "moralis": "^0.0.90",
    "react-moralis": "^0.2.6"
  },
  "scripts": {
    "start": "craco 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"
    ]
  },
  "devDependencies": {
    "@types/styled-components": "^5.1.15"
  }
}

Only throw an error after you call useMoralis() …
import react-moralis file that is fine.