I have problem and cannot find any solution. How can i use javascript functions after bundling by webpack but in html?
I have file app.js that contains: import qs from 'query-string'
(from npm install query-string
) and some my code. After i run npm run dev
that conatins webpack --mode production
it creates another bundle file with my function and query-string. Now i need to use it in my html code like:
<p>some text</p>
<script>
const someConst = someFunctionFromBundle();
</script>
But after bundling webpack removes someFunctionFromBundle() because of tree shaking. How to prevent webpack from tree shaking specific functions?