iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐈
How to call functions bundled with Webpack from HTML
Conclusion
- Assign it to a property of the window object
Situation
<!DOCTYPE html>
<html>
<body>
<button onclick="hello()">hello world</button>
<script src="main.js"></script>
</body>
</html>
Example
const hello = () => {
alert("hello");
}
window.hello = hello;
References
Discussion