1.0.0 • Published 4 years ago
wps-driver-react v1.0.0
云协作Web
云协作前端工程,可与web_config工程配合使用
打包
本工程使用npm管理依赖库,使用webpack对源码进行打包编译,编辑工具推荐Sublime Text。
打包前需要先安装nodejs,确保nodejs的版本支持es6,建议在5.0.0以上 https://nodejs.org/zh-cn/
并且保证依赖库已经安装齐全,如依赖库有欠缺,需要在代码根目录(需先安装nodejs)运行:
npm install
确认所需的依赖库都齐备后,在根目录按需运行:
生产环境:export NODE_ENV=production && PROJECT_ENV=production && gulp
开发环境:export NODE_ENV=develop && PROJECT_ENV=develop && gulp
即可完成打包,编译输出的文件在 dist 目录中
运行
本工程与后端分离,理论上只需要有web服务器代理编译后的文件即可单独运行
这里列出nginx的配置方法
server {
listen 80;
server_name yun.wps.cn;
location / {
root ~/web_yun/dist/;
index login.html index.html;
try_files $uri /index.html =404;
}
location /landing {
alias ~/web_yun/dist/landing;
}
location /view {
alias ~/web_yun/dist/view;
index login.html index.html;
try_files $uri /index.html =404;
}
location /api {
proxy_next_upstream off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto "https";
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://servicerIP/api;
}
}
之后通过dns或修改hosts的方法访问该web服务器即可
127.0.0.1 yun.wps.cn
但想真正可用,仍需搭配后端相关服务使用
1.0.0
4 years ago