I am trying to learn ES6 imports and exports but I ran into an error that is not letting me import my module. I also tried import .. from 'add.js' without ./ but still no luck.
Uncaught SyntaxError: The requested module './add.js' does not provide an export named 'add'
My folder structure looks like this
C:\xampp\htdocs\es6\import.export\
- index.html
- app.js
- add.js
index.html
<html>
<head>
<script type="module" src="app.js"></script>
</head>
<body>
</body>
</html>
app.js
import { add } from './add.js'
console.log(add(2,3))
add.js
export default function add (a, b) {
// export default function (a, b) { <-- does not work either, same error
return a + b;
}