安装vue-cli以后,build文件夹下面没有dev-server.js文件,浏览器也不再自动打开。

图片描述

执行npm run dev 命令后,会给一个URL:http://localhost:8081/,而不是自动打开默认浏览器。

阅读 5.1k
3 个回答

config/index.js中,把autoOpenBrowser改成true,就能自动打浏览器了,亲测可用。
图片描述

更新说明

New /config/index.js options (#975)

dev:
autoOpenBrowser: Wether to open a new browser tab whenever the dev server starts.
useEslint: Wether to use eslint-loader in webpack. Some people might only want to use eslint in their IDE, so the loader can be deactivated here.
showEslintErrorsInOverlay: if using eslint-loader, this option allows to switch of the eslint errors in the error overlay shown in the browser. the errors still appear in the console & terminal, but don't break the workflow in the browser anymore.
notifyOnErrors: will show OS notifications whenever a build fails. Useful when your builds take some time
poll: enables polling mode for webpack's file-change watcher. The default mode doesn't work in some environments, like dropbox folders, Vagrant etc. so switching to polling can fix this.
you can now change sourcemap-related options for the dev and prod builds in the config file.

我也遇到这个问题,真坑爹,现在想写服务端也写不了,自己写又会出很多问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题