|
|
10 months ago | |
|---|---|---|
| public | 1 year ago | |
| src | 10 months ago | |
| .dockerignore | 1 year ago | |
| .drone.yml | 1 year ago | |
| .editorconfig | 1 year ago | |
| .env.development | 1 year ago | |
| .env.production | 1 year ago | |
| .env.test | 1 year ago | |
| .eslintignore | 1 year ago | |
| .eslintrc.js | 1 year ago | |
| .gitignore | 1 year ago | |
| .prettierignore | 1 year ago | |
| .prettierrc | 1 year ago | |
| Dockerfile | 1 year ago | |
| README.md | 1 year ago | |
| babel.config.js | 1 year ago | |
| index.html | 1 year ago | |
| jsconfig.json | 1 year ago | |
| package.json | 1 year ago | |
| postcss.config.js | 1 year ago | |
| tailwind.config.js | 1 year ago | |
| vite.config.js | 1 year ago |
# install dependency
npm install
# develop
npm run dev
# build for test environment
npm run build
# build for production environment
npm run build:prod
# preview the release environment effect
npm run preview
# preview the release environment effect + static resource analysis
npm run preview -- --report
# code format check
npm run lint
# code format check and auto fix
npm run lint -- --fix
以上为传统开发方案. 如果你遇到了 本地需要多个 node 环境 / 自己的项目需要新版 nodejs 又不想来回切 / 统一各平台开发差异 / 不想装 nodejs(环境洁癖) / 甚至本机装不上 nodejs 等场景, 可以考虑 Docker 开发方案.
或者这步跳过也行, 反正build镜像的时候, docker会自动拉取需要的基础镜像.
docker pull node:20.14.0-slim
docker build -t au_admin_front:dev .
docker run -d -p 3333:3333 -v ${PWD}:/app --name au_admin_front au_admin_front:dev
注: 如果 win 平台跑不起来, 把${PWD}换成项目(从盘符起)的绝对路径.
注 2: 如果 win 平台无法正确热更新, 且改完代码后手动刷新浏览器也没变化, 可以考虑把Dockerfile文件里面的CHOKIDAR_USEPOLLING环境变量行首注释解开.
注 3: 用 docker 方案就不要用你本机的 node.js/npm 来操作项目里面的命令, 如 npm i, 要用 docker 容器里面的 npm 来操作