I use webpack for module loading. Everything works fine except click events from html.
For example I want to do this;
<li id="a" onclick="f(this.id)">lorem</li>
but getting this error whenever I click that element:
Uncaught ReferenceError: f is not defined
The compiled js file (that functions part):
function f(d) {
console.log(d);
}
then I realized, actually it is in a global webpack function:
function(module, exports, __webpack_require__) {
function f(d) {
console.log(d);
}
}
I think that this is the reason of the problem.
How can I fix this?
P.S.: I tried handling event from code, it didn't work either.