Followed webpack installation in 5.2 version
Prerequisites
- [X] I have searched for duplicate or closed issues
- [X] I have validated any HTML to avoid common problems
- [x] I have read the contributing guidelines
Describe the issue
I follow the exact steps in the webpack installation here
I'm using VS code also extension live server, I change my port to 5500 because its the live server port used by the extension, so in the code part where port 8080
devServer: { static: path.resolve(__dirname, 'dist'), port: 8080, hot: true },
I change mine to 5500
1st Error: GET http://127.0.0.1:5500/dist/main.js net::ERR_ABORTED 404 (Not Found)
In this code
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap w/ Webpack</title>
</head>
<body>
<div class="container py-4 px-3 mx-auto">
<h1>Hello, Bootstrap and Webpack!</h1>
<button class="btn btn-primary">Primary button</button>
</div>
<script src="./main.js"></script>
</body>
</html>
My fix, I tried both below: (correcting the path as I try to CTRL + click the path its working)
<script src="../src/js/main.js"></script>
also
<script type="module" src="../src/js/main.js"></script>
2nd Error: Uncaught TypeError: Failed to resolve module specifier "bootstrap". Relative references must start with either "/", "./", or "../".
Reduced test cases
N/A
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
No response
What version of Bootstrap are you using?
5.2.0
Issue resolved by using the command "npx webpack" also returning the path in index.html to
<script src="./main.js"></script>
Let us know if there's something that needs updating in our guide and the associated https://github.com/twbs/examples example.