使用anywhere的npm包
安装
npm install -g anywhere
命令
Usage:
anywhere --help // print help information
anywhere // 8000 as default port, current folder as root
anywhere 8888 // 8888 as port
anywhere -p 8989 // 8989 as port
anywhere -s // don't open browser
anywhere -h localhost // localhost as hostname
anywhere -d /home // /home as root
anywhere -f /index.html // Enable html5 history,the index is /index.html
anywhere --proxy http://localhost:7000/api // Support shorthand URL, webpack.config.js or customize config file
常用组合
指定某dist文件夹作为html的本地静态服务
anywhere -d $folderPath/dist -h localhost -f /index.html