I'm having the following error when trying to run a module in JavaScript:
Uncaught SyntaxError: Unexpected identifier
- index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Módulos JavaScript</title>
<script src="index.js"></script>
</head>
<body>
<!-- BODY -->
</body>
</html>
- index.js
import nome from './src/config';
console.log(nome);
- src / config.js
const nome = 'ECMAScript 6'
export default nome;
Why the error happens?