skip to Main Content

In my game wiki made with React JSX, there is an error:

 SyntaxError: The requested module '/src/components/Menu.jsx?t=1724725277296' does not provide an export named 'Menu'

but, the paths are correct (using CTRL-CLICK on vscode helps alot)
And where it exports baseURL is exporting it correctly.

I tried in the Menu component to use parenthesis and square brackets, yet it didn’t work.

import React from 'react'
import logo from '../assets/logo.png'
const baseURL = 'http://localhost:5173';

const Menu = () => {
  return (
    <nav className="navbar navbar-expand-lg bg-dark">
      <div className="container-fluid">
        <a className="navbar-brand" href="#"><img src={logo} alt="Moncria" height="192" /></a>
        <button className="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
          <span className="navbar-toggler-icon"></span>
        </button>
        <div className="collapse navbar-collapse" id="navbarNav">
          <ul className="navbar-nav">
            <li className="nav-item">
              <a className="nav-link active text-success" href={baseURL}>Home</a>
            </li>
            <li className="nav-item">
              <a className="nav-link active text-danger" href={`${baseURL}/wiki`}>Wiki</a>
            </li>
            <li className="nav-item">
              <a className="nav-link active text-warning" href={`${baseURL}/users`}>Users</a>
            </li>
            <li className="nav-item">
              <a className="nav-link active" style={{color: '#fc0fc0'}} href={`${baseURL}/register`}>Register</a>
            </li>
            <li className="nav-item">
              <a className="nav-link active text-primary" href={`${baseURL}/register`}>Login</a>
            </li>
          </ul>
        </div>
      </div>
    </nav>
  )
}

export default [ Menu, baseURL ]

2

Answers


  1. Do u import like this?

    import { Menu } from '/src/...';
    

    Maybe try

    import MenuConfig from '/src/...';
    const [Menu, baseURL] = MenuConfig;
    
    Login or Signup to reply.
  2. You can try this

    export { Menu, baseURL };
    ...
    import { Menu, baseURL } from './Menu';
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search