I'm using https://github.com/sloria/cookiecutter-flask for a project and I'm trying to add a javascript function to a js file that's bundled by webpack and access it from the html. I think I'm missing something basic.
Source files for background:
- https://github.com/sloria/cookiecutter-flask/blob/master/%7B%7Bcookiecutter.app_name%7D%7D/webpack.config.js
- https://github.com/sloria/cookiecutter-flask/blob/master/%7B%7Bcookiecutter.app_name%7D%7D/assets/js/plugins.js
I'm adding the following code to plugins.js:
function foo () {
console.log('bar')
}
And trying to call it from an html document to test as follows
<script type="text/javascript">
foo();
</script>
I can see that my function got bundled, but I can't access it.
I already had to add expose-loader to my webpack.config.js to get jquery to work as per this issue: