webpack自动刷新的问题
页面能看的,但不能自动刷新,求教
index.html
<body>
<div id="app"></div>
<script src="bundle.js"></script>
</body>
entry.js
var oApp=document.getElementById('app');
import modA from './a.js';
require('./style.css');
oApp.innerHTML="<h1>welcome</h1>"+modA.a+modA.b;
a.js
export default{
a:1,
b:6
}
webpack.config.js
module.exports={
entry:'./entry.js',
output:{
filename:"bundle.js"
},
devtool:"source-map",
module:{
loaders:[
{
test:/\.css$/,
loader:"style!css"
},
{
test:/\.js$/,
loader:"babel",
exclude:/node_modules/
}
]
}
}
.babelrc
{
"presets":["es2015"]
}
我执行了webpack-dev-server --inline
命令提示
http://localhost:8088/
webpack result is served from /
content is served from C:\Users\fernando\Desktop\webpack
Hash: 7a67194c1a3405c4a4f2
Version: webpack 1.14.0
Time: 14947ms
Asset Size Chunks Chunk Names
bundle.js 254 kB 0 [emitted] main
bundle.js.map 308 kB 0 [emitted] main
chunk {0} bundle.js, bundle.js.map (main) 234 kB [rendered]
[0] multi main 40 bytes {0} [built]
[1] C:/Users/fernando/AppData/Roaming/npm/~/webpack-dev-server/client?http://localhost:8088 3.97 kB {0} [built]
.........
[78] ./style.css 895 bytes {0} [built]
[79] ./~/css-loader!./style.css 242 bytes {0} [built]
[80] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built]
[81] ./~/style-loader/addStyles.js 7.15 kB {0} [built]
webpack: bundle is now VALID.
但我修改样式后,并没有自动刷新,手动点刷新也没用
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试加上--hot