.. | ||
.vscode | ||
public | ||
src | ||
.gitignore | ||
.webpackrc | ||
build.js | ||
index.css | ||
index.html | ||
index.js | ||
package-lock.json | ||
package.json | ||
README.md |
开始项目
cnpm 安装(可忽略)
npm install -g cnpm --registry=https://registry.npm.taobao.org
# 设置匿名
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
# Or alias it in .bashrc or .zshrc
$ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
安装依赖
cnpm install
启动
npm start
构建打包
npm run build
代理配置
根目录下的 .webpackrc 修改proxy属性
"proxy": {
"/": {
"target": "http://ip:port/", //这边写你自己的服务Ip
"changeOrigin": true,
"pathRewrite": { "^/" : "" }
}
},