Trying to Understand JS File Interactions
Index.js
const add = require('./app');
const result = add(10,5);
console.log(result);
app.js
function add(num1,num2){
return num1+num2;
}
module.exports = add;
webpack config
const path = require('path');
const settings ={
entry:"./app/index.js",
output:{
path:path.resolve(__dirname,"app/build"),
filename:'bundle.js'
}
}
module.exports = settings;
The bundle.js is being generated successfully. It has been added to the index.html file and loads without any issues in the network tab. However, the console.log(result)
statement does not seem to be working as expected.