I have 3 files one HTML, 2 javascript files named app.js and customer .js
I have an HTML page on which I have written this
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
hello
<script src="app.js" type="module"></script>
</body>
</html>
I just loaded app.js into this page
app.js contains this
import {person} from "./customer";
console.log("helllo");
and in customer.js i have this
const person={
name:"hello"
}
export default person;
I am getting an import error the error shows
GET http://127.0.0.1:5500/customer net::ERR_ABORTED 404 (Not Found)
I am new to web development, please help me.
import {person} from "/customer.js";You're relying on the browser, not a Javascript bundler.exportandexport default. Remove the curly braces if you want to keep using export default.import person from "/customer.js