简体   繁体   English

无法使Hot Module在Atom中工作

[英]Cannot get Hot Module working in Atom

I've installed everything what I need (webpack, webpack-server), confingured my webpack.config.js and package.json, still the localhost:8080 does not render on safe. 我已经安装了我需要的所有东西(webpack,webpack-server),配置了我的webpack.config.js和package.json,但是localhost:8080仍然无法安全呈现。 Neither does it render on localhost:8080/webpack-dev-server/index.html on safe. 安全地也不会在localhost:8080 / webpack-dev-server / index.html上呈现。 On manual reload it renders perfectly. 在手动重新加载时,它呈现完美。

package.json : package.json

在此处输入图片说明

webpack.config.js webpack.config.js 在此处输入图片说明

npm run dev executes successfully but I also have to reload the page manually after I make some changes in my index.html which is in the parent folder. npm run dev成功执行,但是在父文件夹中的index.html中进行一些更改后,我还必须手动重新加载页面。 Also, I always have to run webpack manually in my cmd when I change my .js file. 另外,更改.js文件时,我总是必须在cmd中手动运行webpack Hot loading should also take care of this if I'm correct. 如果我是正确的话,热加载也应该注意这一点。

Let me also add that the app is recompiling when I run CTRL+s but it doesn't actually recompile. 我还要补充一点,当我运行CTRL + s时,应用程序正在重新编译,但实际上并没有重新编译。

在此处输入图片说明

I had a similar problem with live reloading on changes. 我对更改进行实时重新加载也遇到了类似的问题。 Try to change link to bundle.js in your index.html <script src="/bundle.js"></script> If you look in console output after npm start there will be same like webpack output is served from / Dev-server takes bundle from root directory of your project, not from /js/bundle.js 尝试在index.html <script src="/bundle.js"></script>更改到bundle.js的链接。如果您在npm启动后查看控制台输出,则会像webpack output is served from /一样服务器从项目的根目录中获取捆绑包,而不是从/js/bundle.js中获取

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM