I have a JavaScript file, 'submittedForms.js' that I reference in my blade.php
with
<script type="module" src="/js/bundle/charts/submittedForms.js"></script>
In submittedForms.js
, I've defined a simple function called 'functionTest' and a variable that represents a chart called 'submittedForms'. I want to import both in my blade.php. The chart variable imports and is rendered fine! However, when I add the function and alter the export to be;
module.exports = {
functionTest() {
console.log('this works');
},
submittedForms
};
the following error thrown from the blade pops up;
"Uncaught ReferenceError: functionTest is not defined"
In the blade.php
I'm calling functionTest like this;
functionTest()