I have a folder for test only that contain only 3 file
- index.js
- sample.js
- index.html
Index.html
<!DOCTYPE html>
<html>
<head>
<script src="index.js"></script>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
index.js
import { data } from './sample';
console.log(data)
const newObj = Object.entries(sampleOb).filter((item, index) => index === 0)
console.log(Object.fromEntries(newObj) )
sample.js
export const data = {
name:"abc",
age:"19"
}
But problem is when i try to import data.js to index.js, it show this error
So how to fix this, thank you
script
can have amodule
type