I'm trying to build an electron app. I want to import some functions from another js files. but while using import i gets error showing
cannot use import statement outside a module why this happening
my code is eventsource.js
import { sample } from './eventhandler'
console.log('inside eventsource');
function test(){
console.log('test function')
}
test();
sample();
eventhandler.js
export function sample(){
console.log('sample')}
prototype.html
<!DOCTYPE html>
<html>
<head>
<meta charset = "UTF-8">
<title>sample</title>
<script type="module" src="../views/eventsource.js"></script>
</head>
<body class="content">
</body>
</html>