chore: 统一各 app 的构建目录
This commit is contained in:
@@ -4,5 +4,7 @@ ENV = 'development'
|
||||
# 公共基础路径, 详见: https://cn.vitejs.dev/guide/build.html#public-base-path
|
||||
VITE_BASE_URL = /
|
||||
|
||||
# base api url
|
||||
VITE_BASE_API_URL = 'https://custom-chart-pre-api.shiyue.com/'
|
||||
# 前端可见变量(必须以 VITE_ 开头)
|
||||
VITE_PORT = 10010
|
||||
VITE_BASE_API_URL = 'https://custom-chart-pre-api.shiyue.com/'
|
||||
VITE_DEBUG_MODE = true
|
||||
8
apps/renderer/.env.staging
Normal file
8
apps/renderer/.env.staging
Normal file
@@ -0,0 +1,8 @@
|
||||
# 只在预发布模式中被载入
|
||||
ENV = 'staging'
|
||||
|
||||
# 公共基础路径, 详见: https://cn.vitejs.dev/guide/build.html#public-base-path
|
||||
VITE_BASE_URL = /
|
||||
|
||||
# base api url
|
||||
VITE_BASE_API_URL = 'https://custom-chart-pre-api.shiyue.com/'
|
||||
@@ -1,23 +1,35 @@
|
||||
import { defineConfig } from "@farmfe/core";
|
||||
import { defineConfig, loadEnv } from "@farmfe/core";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import mkcert from "vite-plugin-mkcert";
|
||||
import Http2Proxy from "@sy/vite-plugin-http2-proxy";
|
||||
import path from "path";
|
||||
|
||||
export default defineConfig({
|
||||
server: {
|
||||
// 本地开发时允许跨域访问该项目
|
||||
port: 10010,
|
||||
cors: true,
|
||||
},
|
||||
// @ts-ignore
|
||||
vitePlugins: [vue(), mkcert({ source: "coding" }), Http2Proxy()],
|
||||
compilation: {
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(process.cwd(), "src"),
|
||||
$vtj: path.resolve(process.cwd(), ".vtj"),
|
||||
// @ts-ignore
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), ["VITE_"]);
|
||||
|
||||
return {
|
||||
server: {
|
||||
port: env.VITE_PORT,
|
||||
cors: true,
|
||||
},
|
||||
// @ts-ignore
|
||||
vitePlugins: [vue(), mkcert({ source: "coding" }), Http2Proxy()],
|
||||
compilation: {
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(process.cwd(), "src"),
|
||||
$vtj: path.resolve(process.cwd(), ".vtj"),
|
||||
},
|
||||
},
|
||||
define: {
|
||||
// 注入环境变量到客户端
|
||||
"process.env": JSON.stringify(env),
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(process.cwd(), "../../dist/renderer"),
|
||||
clean: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "farm dev",
|
||||
"start": "farm start",
|
||||
"build": "farm build",
|
||||
"dev": "farm dev --mode development",
|
||||
"start": "farm start --mode production",
|
||||
"build": "farm build --mode production",
|
||||
"preview": "farm preview",
|
||||
"clean:lock": "rimraf pnpm-lock.yaml && rimraf package.lock.json",
|
||||
"clean:lib": "rimraf node_modules",
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import { defineConfig } from "vite";
|
||||
import http2Proxy from "@sy/vite-plugin-http2-proxy";
|
||||
import mkcert from "vite-plugin-mkcert";
|
||||
import VuePlugin from "@vitejs/plugin-vue";
|
||||
|
||||
export default defineConfig({
|
||||
server: {
|
||||
port: 10010,
|
||||
},
|
||||
plugins: [http2Proxy(), mkcert(), VuePlugin()],
|
||||
esbuild: {
|
||||
supported: {
|
||||
"top-level-await": true,
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user