diff --git a/.eslintrc.js b/.eslintrc.js index 7acba63..9f23cbd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,6 @@ // @see: http://eslint.cn -module.exports = { +export default { root: true, env: { browser: true, diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..75b9882 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "i18n-ally.localesPaths": [ + "src/languages" + ] +} \ No newline at end of file diff --git a/docker/dockerfile b/docker/dockerfile new file mode 100644 index 0000000..7e130ef --- /dev/null +++ b/docker/dockerfile @@ -0,0 +1,23 @@ +# 使用官方的 Nginx 镜像作为基础镜像 +FROM nginx + +# 删除默认的 Nginx 配置文件 +RUN rm /etc/nginx/conf.d/default.conf + +# 将自定义的 Nginx 配置文件复制到容器中 +COPY nginx.conf /etc/nginx/conf.d/ + +# 创建一个目录来存放前端项目文件 +WORKDIR /usr/share/nginx/html + +# 将前端项目打包文件复制到 Nginx 的默认静态文件目录 +COPY dist/ /usr/share/nginx/html +# 复制到nginx目录下 +COPY dist/ /etc/nginx/html + +# 暴露 Nginx 的默认端口 +EXPOSE 80 + +# 自动启动 Nginx +CMD ["nginx", "-g", "daemon off;"] + diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..67110b3 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,27 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /etc/nginx/html; + index index.html index.htm; + try_files $uri /index.html; + } + + # 后端跨域请求 + location ~/api/ { + proxy_pass http://192.168.3.98:1001; + } + + # mock 跨域 + location ~/mock/ { + proxy_pass http://192.168.3.98:1001; + } + + error_page 404 404.html; + + location = /50x.html { + root html; + } +} \ No newline at end of file diff --git a/uno.config.ts b/uno.config.ts index 09c3204..953fa19 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -1,6 +1,6 @@ -import { defineConfig } from "@unocss/vite"; import presetUno from "@unocss/preset-uno"; import transformerDirectives from "@unocss/transformer-directives"; +import { defineConfig } from "@unocss/vite"; export default defineConfig({ content: {