美文网首页webpack学习
webpack-dev-server 自动刷新页面

webpack-dev-server 自动刷新页面

作者: 就当我扯淡 | 来源:发表于2016-12-22 09:31 被阅读334次

    只需要在webpack.config.js中加入devServer: { inline: true }的配置即可。
    然后命令行执行如下命令就行了

    webpack-dev-server --inline
    
    Paste_Image.png

    官方文档如下:
    http://webpack.github.io/docs/webpack-dev-server.html#additional-configuration-options

    Inline mode
    To use the inline mode, either
    specify --inline
    on the command line.
    specify devServer: { inline: true }
    in your webpack.config.js

    This adds the webpack-dev-server client entry point to the webpack configuration. There is no change in the URL required. Just navigate to http://«host»:«port»/«path»
    .
    With the above configuration: http://localhost:8080/index.html
    .
    Config option or command line flag needed.
    Status information in the console and (briefly) in the browser’s console log.
    URL changes in the app are reflected in the browser’s URL bar.

    相关文章

      网友评论

        本文标题:webpack-dev-server 自动刷新页面

        本文链接:https://www.haomeiwen.com/subject/pipcvttx.html