diff --git a/build/vite/plugin/html.js b/build/plugin/html.js
similarity index 87%
rename from build/vite/plugin/html.js
rename to build/plugin/html.js
index 1502d87..471f3ab 100644
--- a/build/vite/plugin/html.js
+++ b/build/plugin/html.js
@@ -1,6 +1,6 @@
import html from 'vite-plugin-html'
-import { version } from '../../../package.json'
-import { GLOB_CONFIG_FILE_NAME } from '../../constant'
+import { version } from '../../package.json'
+import { GLOB_CONFIG_FILE_NAME } from '../constant'
export function configHtmlPlugin(viteEnv, isBuild) {
const { VITE_APP_TITLE, VITE_PUBLIC_PATH } = viteEnv
diff --git a/build/vite/plugin/index.js b/build/plugin/index.js
similarity index 100%
rename from build/vite/plugin/index.js
rename to build/plugin/index.js
diff --git a/build/vite/plugin/mock.js b/build/plugin/mock.js
similarity index 100%
rename from build/vite/plugin/mock.js
rename to build/plugin/mock.js
diff --git a/build/vite/plugin/unocss.js b/build/plugin/unocss.js
similarity index 100%
rename from build/vite/plugin/unocss.js
rename to build/plugin/unocss.js
diff --git a/build/utils.js b/build/utils.js
index 178e594..81765f6 100644
--- a/build/utils.js
+++ b/build/utils.js
@@ -2,6 +2,8 @@ import fs from 'fs'
import path from 'path'
import dotenv from 'dotenv'
+const httpsRE = /^https:\/\//
+
export function wrapperEnv(envOptions) {
if (!envOptions) return {}
const ret = {}
@@ -31,6 +33,24 @@ export function wrapperEnv(envOptions) {
return ret
}
+export function createProxy(list = []) {
+ const ret = {}
+ for (const [prefix, target] of list) {
+ const isHttps = httpsRE.test(target)
+
+ // https://github.com/http-party/node-http-proxy#options
+ ret[prefix] = {
+ target: target,
+ changeOrigin: true,
+ ws: true,
+ rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
+ // https is require secure=false
+ ...(isHttps ? { secure: false } : {}),
+ }
+ }
+ return ret
+}
+
/**
* 获取当前环境下生效的配置文件名
*/
diff --git a/build/vite/proxy.js b/build/vite/proxy.js
deleted file mode 100644
index 74cc5a7..0000000
--- a/build/vite/proxy.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const httpsRE = /^https:\/\//
-export function createProxy(list = []) {
- const ret = {}
- for (const [prefix, target] of list) {
- const isHttps = httpsRE.test(target)
-
- // https://github.com/http-party/node-http-proxy#options
- ret[prefix] = {
- target: target,
- changeOrigin: true,
- ws: true,
- rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
- // https is require secure=false
- ...(isHttps ? { secure: false } : {}),
- }
- }
- return ret
-}
diff --git a/vite.config.js b/vite.config.js
index e1222d3..8ee6eb1 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1,9 +1,8 @@
import { defineConfig, loadEnv } from 'vite'
import path from 'path'
-import { wrapperEnv } from './build/utils'
-import { createVitePlugins } from './build/vite/plugin'
-import { createProxy } from './build/vite/proxy'
+import { wrapperEnv, createProxy } from './build/utils'
+import { createVitePlugins } from './build/plugin'
import { OUTPUT_DIR } from './build/constant'
export default defineConfig(({ command, mode }) => {