只需要在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.
网友评论