Reputation: 33974
My webpack 4 generates index.html in build folder and the bundle.js is included twice in the generated index.html.
Folder structure
ui >
webpack.config.js
index.html
build >
index.html
bundle.js
ui --> index.html
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Cabin+Sketch" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div id="App">
<!-- this is where the root react component will get rendered -->
</div>
<script type="text/javascript" src="/bundle.js"></script></body>
</html>
webpack generated index.html under build folder
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Cabin+Sketch" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div id="App">
<!-- this is where the root react component will get rendered -->
</div>
<script src=build/rapido-web.js></script>
<script type="text/javascript" src="/rapido-web.js"></script>
</body>
</html>
Any idea why bundle.js included twice
Upvotes: 1
Views: 577
Reputation: 703
Remove the manual reference to the bunde.js
from your index.html. HtmlWebpackPlugin
injects bundle to the html out of the box
Upvotes: 3