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
Do u import like this?
Maybe try
You can try this