When I launch webpack-dev-server and navigate to homepage at localhost:8000, everything works as normal. However, when I navigate to localhost:8000/app/home, the console indicates that bundle.js cannot be found. How should I deal with this?
Folder structure:
dist/
index.html
app/
js/
homepage.jsx
event.jsx
home.jsx
css/
style.css
app.js
webpack.config.js
index.html imports bundle with:
<script src="./bundle.js"></script>
Try using an absolute path:
<script src="/bundle.js"></script>
Otherwise, the client will request /app/home/bundle.js
, which doesn't exist.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.