I am trying to import a function from a separate .js file. When I declare the import command the page is not executing the code. But when I delete the import command and execute a simple alert('Hello'), that thing is popping up on the page.
PROJECT STRUCTURE
--Todo-app
----js
------two.js
------main.js
----index.html
Index.html
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script src="js/main.js"></script>
</body>
</html>
two.js
export function one() {
return 1 + 1;
}
main.js
import { one } from 'two';
alert(one());