vue/react打包文件可直接浏览器打开

之前我们使用vue/react 打包 npm run build 之后生成的dist 文件,想要运行代码,需要部署在nginx上面才能运行。配置文件也比较麻烦。
现在分享一个直接可以浏览器打开的方法
通过cmd命令
先在全局中安装browser-sync

npm install -g browser-sync
cd  ‘dist文件目录’
browser-sync start --server --files "*.css, *.html , *.js" --reload-delay 800 -no-ghost-mode --open external --host= I P

可直接在浏览器上输入IP就要访问了,非常方便

猜你喜欢

转载自blog.csdn.net/wang15180138572/article/details/114735367
今日推荐