My sum.js file as below
var mathOp = {
sum : function(a,b){
return a+b;
}
}
export default mathOp;
My index.js file as below (It will have multiple import file and tree shaking later point of time)
import mathOp from "./sum";
export default mathOp;
I have made a bundle file bundle.js using webpack for above two files and called bundle.js in an index.html file as below
<script type="text/javascript" src="/bundle.js"></script></body>
Now I wanted to call mathOp.sum function in my index.html file as below
<script type="text/javascript">
$(document).ready(function(){
var result = mathOp.sum(2,5);
console.log(result);
});
</script>
But I am not able to do it? can any one guide me how to do it?