I have a webpack config js like this:
entry: {
language: path.resolve(__dirname, 'src/scripts/lang.js'),
config: path.resolve(__dirname, 'src/scripts/config.js'),
mainFunctions: path.resolve(__dirname, 'src/scripts/utilFunctions.js'),
},
And this script sequence bottom of html file:
<script src="../plugins/jQuery/jquery-3.4.1.min.js"></script>
<script src="../plugins/Popper/popper.min.js"></script>
<script src="../plugins/Bootstrap/bootstrap.min.js"></script>
<script src="../plugins/Magnific/magnificPopup.min.js"></script>
</body>
</html>
So after compile HtmlWebpackPlugin generates a this structure:
<script src="../plugins/jQuery/jquery-3.4.1.min.js"></script>
<script src="../plugins/Popper/popper.min.js"></script>
<script src="../plugins/Bootstrap/bootstrap.min.js"></script>
<script src="../plugins/Magnific/magnificPopup.min.js"></script>
<script type="text/javascript" src=".././js/language-82d9013312d51ba09842.js"></script>
<script type="text/javascript" src=".././js/vendors~config-620ba3d9ae4472f968ab.js"></script>
<script type="text/javascript" src=".././js/config-28c647d3bd0894bac005.js"></script>
<script type="text/javascript" src=".././js/utilFunctions-1ae3ee4b074ef90d909b.js"></script>
</body>
</html>
The question is how to include for each html file it's own js script which final result should be like this.
In index.html
// ----- connected scripts in here -------- //
<script type="text/javascript" src=".././js/utilFunctions-1ae3ee4b074ef90d909b.js"></script>
<script type="text/javascript" src=".././js/index.js"></script>
</body>
In home.html
// ----- connected scripts in here -------- //
<script type="text/javascript" src=".././js/utilFunctions-1ae3ee4b074ef90d909b.js"></script>
<script type="text/javascript" src=".././js/home.js"></script>
</body>
I can not add to after utilFunctions in entry object (inside of webpack.config.js) then included part will be in every html file.
Also I can not add in html files because order should be like this:First plugins then my own functions. Please help I stuck.