[英]Webpack-dev-server Bundle.js not found
When I launch webpack-dev-server and navigate to homepage at localhost:8000, everything works as normal. 当我启动webpack-dev-server并导航到localhost:8000的主页时,一切正常。 However, when I navigate to localhost:8000/app/home, the console indicates that bundle.js cannot be found.
但是,当我导航到localhost:8000 / app / home时,控制台指示找不到bundle.js。 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: index.html导入包,其中包括:
<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. 否则,客户端将请求
/app/home/bundle.js
,该请求不存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.