init
This commit is contained in:
21
web/.devcontaier/evcontainer.json
Normal file
21
web/.devcontaier/evcontainer.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "Node.js 22 Development Environment",
|
||||
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",
|
||||
"runArgs": [
|
||||
"--env",
|
||||
"TZ=Asia/Shanghai"
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.defaultProfile.linux": "/bin/bash",
|
||||
"terminal.integrated.env.linux": {
|
||||
"TZ": "Asia/Shanghai"
|
||||
}
|
||||
},
|
||||
"remoteEnv": {
|
||||
"TZ": "Asia/Shanghai"
|
||||
},
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint"
|
||||
],
|
||||
"postCreateCommand": "sudo ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai | sudo tee /etc/timezone && pnpm install -g @kevisual/envision-cli@latest && npm install"
|
||||
}
|
||||
28
web/.gitignore
vendored
Normal file
28
web/.gitignore
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
.env
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
tsconfig.app.tsbuildinfo
|
||||
tsconfig.node.tsbuildinfo
|
||||
3
web/.npmrc
Normal file
3
web/.npmrc
Normal file
@@ -0,0 +1,3 @@
|
||||
//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN}
|
||||
@abearxiong:registry=https://npm.pkg.github.com
|
||||
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||
1
web/README.md
Normal file
1
web/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# vite-react-template
|
||||
31
web/eslint.config.js
Normal file
31
web/eslint.config.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import js from '@eslint/js';
|
||||
import globals from 'globals';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import reactRefresh from 'eslint-plugin-react-refresh';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import react from 'eslint-plugin-react';
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ['dist'] },
|
||||
{
|
||||
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
globals: globals.browser,
|
||||
},
|
||||
plugins: {
|
||||
'react-hooks': reactHooks,
|
||||
'react-refresh': reactRefresh,
|
||||
},
|
||||
rules: {
|
||||
...reactHooks.configs.recommended.rules,
|
||||
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
...react.configs.recommended.rules,
|
||||
...react.configs['jsx-runtime'].rules,
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'no-debugger': 'off',
|
||||
},
|
||||
},
|
||||
);
|
||||
13
web/index.html
Normal file
13
web/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React + TS</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
60
web/package.json
Normal file
60
web/package.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "vite-react",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"basename": "/",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev:web": "cross-env WEB_DEV=true vite --mode web",
|
||||
"build": "vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview",
|
||||
"pub": "envision deploy ./dist -k vite-react -v 0.0.1",
|
||||
"ev": "npm run build && npm run deploy"
|
||||
},
|
||||
"stackblitz": {
|
||||
"startCommand": "npm dev:web"
|
||||
},
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.6.1",
|
||||
"@kevisual/query": "0.0.7-alpha.3",
|
||||
"@kevisual/router": "0.0.7",
|
||||
"@kevisual/system-ui": "^0.0.3",
|
||||
"@kevisual/ui": "^0.0.4-alpha-1",
|
||||
"antd": "^5.24.2",
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.13",
|
||||
"immer": "^10.1.1",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nanoid": "^5.1.2",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-router": "^7.2.0",
|
||||
"react-router-dom": "^7.2.0",
|
||||
"react-toastify": "^11.0.5",
|
||||
"zustand": "^5.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.21.0",
|
||||
"@kevisual/types": "^0.0.6",
|
||||
"@tailwindcss/vite": "^4.0.9",
|
||||
"@types/node": "^22.13.5",
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"@vitejs/plugin-basic-ssl": "^1.2.0",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"eslint": "^9.21.0",
|
||||
"eslint-plugin-react-hooks": "^5.1.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.19",
|
||||
"globals": "^16.0.0",
|
||||
"tailwind-merge": "^3.0.2",
|
||||
"tailwindcss": "^4.0.9",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript-eslint": "^8.25.0",
|
||||
"vite": "^6.2.0"
|
||||
}
|
||||
}
|
||||
3586
web/pnpm-lock.yaml
generated
Normal file
3586
web/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
9
web/src/App.tsx
Normal file
9
web/src/App.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { WeChatLoginForm } from './pages/Login';
|
||||
|
||||
export const App = () => {
|
||||
return (
|
||||
<div className='bg-slate-200 w-full h-screen flex justify-center items-center'>
|
||||
<WeChatLoginForm />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
7
web/src/index.css
Normal file
7
web/src/index.css
Normal file
@@ -0,0 +1,7 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
@layer components {
|
||||
.test-loading {
|
||||
@apply w-20 h-20 bg-gray-300 rounded-full animate-spin;
|
||||
}
|
||||
}
|
||||
6
web/src/main.tsx
Normal file
6
web/src/main.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { App } from './App.tsx';
|
||||
|
||||
import './index.css';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(<App />);
|
||||
1
web/src/modules/basename.ts
Normal file
1
web/src/modules/basename.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const basename = DEV_SERVER ? '/' : BASE_NAME;
|
||||
5
web/src/modules/query.ts
Normal file
5
web/src/modules/query.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { QueryClient } from '@kevisual/query';
|
||||
export const query = new QueryClient({
|
||||
io: true,
|
||||
url: '/api/router',
|
||||
});
|
||||
71
web/src/modules/tencent-captcha.ts
Normal file
71
web/src/modules/tencent-captcha.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
// 定义回调函数
|
||||
export function callback(res) {
|
||||
// 第一个参数传入回调结果,结果如下:
|
||||
// ret Int 验证结果,0:验证成功。2:用户主动关闭验证码。
|
||||
// ticket String 验证成功的票据,当且仅当 ret = 0 时 ticket 有值。
|
||||
// CaptchaAppId String 验证码应用ID。
|
||||
// bizState Any 自定义透传参数。
|
||||
// randstr String 本次验证的随机串,后续票据校验时需传递该参数。
|
||||
console.log('callback:', res)
|
||||
// res(用户主动关闭验证码)= {ret: 2, ticket: null}
|
||||
// res(验证成功) = {ret: 0, ticket: "String", randstr: "String"}
|
||||
// res(请求验证码发生错误,验证码自动返回terror_前缀的容灾票据) = {ret: 0, ticket: "String", randstr: "String", errorCode: Number, errorMessage: "String"}
|
||||
// 此处代码仅为验证结果的展示示例,真实业务接入,建议基于ticket和errorCode情况做不同的业务处理
|
||||
if (res.ret === 0) {
|
||||
// 复制结果至剪切板
|
||||
var str = '【randstr】->【' + res.randstr + '】 【ticket】->【' + res.ticket + '】'
|
||||
var ipt = document.createElement('input')
|
||||
ipt.value = str
|
||||
document.body.appendChild(ipt)
|
||||
ipt.select()
|
||||
document.body.removeChild(ipt)
|
||||
alert('1. 返回结果(randstr、ticket)已复制到剪切板,ctrl+v 查看。 2. 打开浏览器控制台,查看完整返回结果。')
|
||||
}
|
||||
}
|
||||
export type TencentCaptcha = {
|
||||
actionDuration?: number
|
||||
appid?: string
|
||||
bizState?: any
|
||||
randstr?: string
|
||||
ret: number
|
||||
sid?: string
|
||||
ticket?: string
|
||||
errorCode?: number
|
||||
errorMessage?: string
|
||||
verifyDuration?: number
|
||||
}
|
||||
// 定义验证码触发事件
|
||||
export const checkCaptcha = (): Promise<TencentCaptcha> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const callback = (res: TencentCaptcha) => {
|
||||
console.log('callback:', res)
|
||||
if (res.ret === 0) {
|
||||
resolve(res)
|
||||
} else {
|
||||
reject(res)
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
const appid = CAPTCHA_APPID
|
||||
try {
|
||||
// 生成一个验证码对象
|
||||
// CaptchaAppId:登录验证码控制台,从【验证管理】页面进行查看。如果未创建过验证,请先新建验证。注意:不可使用客户端类型为小程序的CaptchaAppId,会导致数据统计错误。
|
||||
//callback:定义的回调函数
|
||||
// @ts-ignore
|
||||
var captcha = new TencentCaptcha(appid, callback, {})
|
||||
// 调用方法,显示验证码
|
||||
captcha.show()
|
||||
} catch (error) {
|
||||
// 加载异常,调用验证码js加载错误处理函数
|
||||
var ticket = 'terror_1001_' + appid + '_' + Math.floor(new Date().getTime() / 1000)
|
||||
// 生成容灾票据或自行做其它处理
|
||||
callback({
|
||||
ret: 0,
|
||||
randstr: '@' + Math.random().toString(36).substring(2),
|
||||
ticket: ticket,
|
||||
errorCode: 1001,
|
||||
errorMessage: 'jsload_error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
36
web/src/modules/wx-login.ts
Normal file
36
web/src/modules/wx-login.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
export const createLogin = async () => {
|
||||
// const redirect_uri = 'http://localhost:6024/user/login'
|
||||
const url = new URL('/api/wx/login', window.location.origin);
|
||||
let redirect_uri = url.toString();
|
||||
if (DEV_SERVER) {
|
||||
redirect_uri = 'https://note.silkyai.cn/user/login';
|
||||
}
|
||||
console.log('redirect_uri', redirect_uri);
|
||||
// @ts-ignore
|
||||
const obj = new WxLogin({
|
||||
self_redirect: false,
|
||||
id: 'weixinLogin', // 需要显示的容器id
|
||||
appid: 'wxea912643e8747b44', // 微信开放平台appid wx*******
|
||||
scope: 'snsapi_login', // 网页默认即可 snsapi_userinfo
|
||||
redirect_uri: encodeURIComponent(redirect_uri), // 授权成功后回调的url
|
||||
state: Math.ceil(Math.random() * 1000), // 可设置为简单的随机数加session用来校验
|
||||
style: '', // 提供"black"、"white"可选。二维码的样式
|
||||
href: 'data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7bWFyZ2luLXRvcDowO30KLmltcG93ZXJCb3ggLnRpdGxlIHtkaXNwbGF5OiBub25lO30=', // 外部css文件url,需要https
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
export const wxId = 'weixinLogin';
|
||||
export function setWxerwma() {
|
||||
const s = document.createElement('script');
|
||||
s.type = 'text/javascript';
|
||||
s.src = '//res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js';
|
||||
s.id = 'weixinLogin-js';
|
||||
if (document.getElementById('weixinLogin-js')) {
|
||||
createLogin();
|
||||
return;
|
||||
}
|
||||
const wxElement = document.body.appendChild(s);
|
||||
wxElement.onload = function () {
|
||||
createLogin();
|
||||
};
|
||||
}
|
||||
26
web/src/pages/Login.tsx
Normal file
26
web/src/pages/Login.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { setWxerwma, wxId } from '@/modules/wx-login';
|
||||
|
||||
const WeChatLogin: React.FC = () => {
|
||||
useEffect(() => {
|
||||
setWxerwma();
|
||||
}, []);
|
||||
return <div id={wxId} className='max-w-sm mx-auto bg-white rounded-lg text-center -mb-16'></div>;
|
||||
};
|
||||
|
||||
export const WeChatLoginForm: React.FC = () => {
|
||||
const serverCom = (
|
||||
<p className='mt-6 text-xs text-center text-[#e69c36]'>
|
||||
登录即表示同意 <span className='font-medium text-[#e69c36]'>服务条款</span> 和 <span className='font-medium text-[#e69c36]'>隐私政策</span>
|
||||
</p>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className='max-w-sm mx-auto p-6 bg-white rounded-lg'>
|
||||
<div className='mt-6 w-[310px] flex flex-col justify-center text-center text-gray-500'>
|
||||
<WeChatLogin />
|
||||
{serverCom}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
101
web/src/pages/store/index.ts
Normal file
101
web/src/pages/store/index.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import { query } from '../../modules/query'
|
||||
|
||||
import { message } from 'antd'
|
||||
import { create } from 'zustand'
|
||||
import { TencentCaptcha } from '@/modules/tencent-captcha'
|
||||
|
||||
type UserStore = {
|
||||
isAuthenticated: boolean
|
||||
qrCodeUrl: string
|
||||
checkAuthStatus: () => void
|
||||
getCode: (phone: string, captcha: TencentCaptcha) => void
|
||||
login: (phone: string, code: string) => void
|
||||
updateUser: (data: any) => void
|
||||
getUpdateUser: () => void
|
||||
data: any
|
||||
setData: (data: any) => void
|
||||
}
|
||||
export const useUserStore = create<UserStore>((set) => ({
|
||||
isAuthenticated: false,
|
||||
qrCodeUrl: '',
|
||||
checkAuthStatus: () => {
|
||||
//
|
||||
},
|
||||
getCode: async (phone, captcha) => {
|
||||
const res = await query.post({
|
||||
path: 'sms',
|
||||
key: 'send',
|
||||
data: {
|
||||
phone,
|
||||
captcha
|
||||
}
|
||||
})
|
||||
if (res.code === 200) {
|
||||
// do something
|
||||
message.success('验证码发送成功')
|
||||
} else {
|
||||
message.error(res.message || '验证码发送失败')
|
||||
}
|
||||
},
|
||||
login: async (phone, code) => {
|
||||
const res = await query.post({
|
||||
path: 'sms',
|
||||
key: 'login',
|
||||
data: {
|
||||
phone,
|
||||
code
|
||||
}
|
||||
})
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
message.success('登录成功')
|
||||
const data = res.data
|
||||
localStorage.setItem('token', data.token)
|
||||
localStorage.setItem('expireTime', data.expireTime)
|
||||
set({ isAuthenticated: true })
|
||||
const href = location.href
|
||||
const url = new URL(href)
|
||||
const redirect = url.searchParams.get('redirect')
|
||||
if (redirect) {
|
||||
const href = decodeURIComponent(redirect)
|
||||
window.open(href, '_self')
|
||||
return
|
||||
}
|
||||
if (data.isNew) {
|
||||
location.href = '/user/info'
|
||||
} else {
|
||||
location.href = '/workspace'
|
||||
}
|
||||
} else {
|
||||
message.error(res.message || '登录失败')
|
||||
}
|
||||
},
|
||||
updateUser: async (data) => {
|
||||
const res = await query.post({
|
||||
path: 'user',
|
||||
key: 'updateInfo',
|
||||
data
|
||||
})
|
||||
if (res.code === 200) {
|
||||
message.success('更新成功')
|
||||
setTimeout(() => {
|
||||
location.href = '/workspace'
|
||||
}, 1000)
|
||||
} else {
|
||||
message.error(res.message || '更新失败')
|
||||
}
|
||||
},
|
||||
getUpdateUser: async () => {
|
||||
const res = await query.post({
|
||||
path: 'user',
|
||||
key: 'getUpdateInfo'
|
||||
})
|
||||
if (res.code === 200) {
|
||||
set({ data: res.data })
|
||||
} else {
|
||||
message.error(res.message || '获取用户信息失败')
|
||||
}
|
||||
},
|
||||
data: {},
|
||||
setData: (data) => set({ data })
|
||||
}))
|
||||
6
web/src/vite-env.d.ts
vendored
Normal file
6
web/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/// <reference types="vite/client" />
|
||||
type SimpleObject = {
|
||||
[key: string | number]: any;
|
||||
};
|
||||
|
||||
declare let BASE_NAME: string;
|
||||
43
web/tsconfig.app.json
Normal file
43
web/tsconfig.app.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": [
|
||||
"ES2020",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
// "jsx": "react",
|
||||
// "jsxFragmentFactory": "Fragment",
|
||||
// "jsxFactory": "h",
|
||||
"jsx": "react-jsx",
|
||||
"baseUrl": "./",
|
||||
"typeRoots": [
|
||||
"node_modules/@types",
|
||||
"node_modules/@kevisual/types",
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noImplicitAny": false,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
"typings.d.ts"
|
||||
]
|
||||
}
|
||||
7
web/tsconfig.json
Normal file
7
web/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
22
web/tsconfig.node.json
Normal file
22
web/tsconfig.node.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
54
web/vite.config.ts
Normal file
54
web/vite.config.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import path from 'path';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import pkgs from './package.json' with { type: 'json' };
|
||||
import basicSsl from '@vitejs/plugin-basic-ssl';
|
||||
|
||||
const version = pkgs.version || '0.0.1';
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const basename = isDev ? '/' : pkgs?.basename || '/';
|
||||
const plugins = []
|
||||
const isWeb = false;
|
||||
if(isWeb) {
|
||||
// 在bolt.new的页面,没有ssl
|
||||
plugins.push(basicSsl())
|
||||
}
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss(), ...plugins],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
base: basename,
|
||||
define: {
|
||||
DEV_SERVER: JSON.stringify(process.env.NODE_ENV === 'development'),
|
||||
VERSION: JSON.stringify(version),
|
||||
BASE_NAME: JSON.stringify(basename),
|
||||
},
|
||||
build: {
|
||||
target: 'esnext',
|
||||
},
|
||||
server: {
|
||||
port: 6004,
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:3000',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||
},
|
||||
'/api/router': {
|
||||
target: 'ws://localhost:3000',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewriteWsOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user