nuxt配置通过指定IP和端口访问的实现

非常简单,只要加一个配置!

第1步,复制这个代码(端口可改)

"config": { "nuxt": { "host": "0.0.0.0", "port": "8090" } },

第2步,找到根目录下的package.json,把代码粘贴进去。

这是全部的代码,我这里配置在了8~13行。

{ "name": "guanWangPhone", "version": "1.0.0", "description": "My bee's knees Nuxt.js project", "author": "kason", "private": true, "config": { "nuxt": { "host": "0.0.0.0", "port": "8090" } }, "scripts": { "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server", "build": "nuxt build", "start": "cross-env NODE_ENV=production node server/index.js", "generate": "nuxt generate" }, "dependencies": { "cross-env": "^5.2.0", "element-ui": "^2.4.11", "koa": "^2.6.2", "nuxt": "^2.0.0", "postcss-px2rem": "^0.3.0" }, "devDependencies": { "node-sass": "^4.13.0", "nodemon": "^1.18.9", "sass-loader": "^8.0.0", "scss-loader": "0.0.1" } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ef8e255c3c8a27bdd03dc99fc2cd1f8c.html