165 lines
18 KiB
JavaScript
165 lines
18 KiB
JavaScript
|
// vite.config.ts
|
||
|
import path2 from "node:path";
|
||
|
import process from "node:process";
|
||
|
import { loadEnv } from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/vite@5.0.12_@types+node@20.11.16_less@4.2.0_terser@5.27.0/node_modules/vite/dist/node/index.js";
|
||
|
import viewport from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/postcss-mobile-forever@4.1.1/node_modules/postcss-mobile-forever/index.js";
|
||
|
import autoprefixer from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/autoprefixer@10.4.17/node_modules/autoprefixer/lib/autoprefixer.js";
|
||
|
|
||
|
// build/vite/index.ts
|
||
|
import vue from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/@vitejs+plugin-vue@5.0.3_vite@5.0.12_vue@3.4.15/node_modules/@vitejs/plugin-vue/dist/index.mjs";
|
||
|
import legacy from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/@vitejs+plugin-legacy@5.3.0_terser@5.27.0_vite@5.0.12/node_modules/@vitejs/plugin-legacy/dist/index.mjs";
|
||
|
import vueJsx from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/@vitejs+plugin-vue-jsx@3.1.0_vite@5.0.12_vue@3.4.15/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs";
|
||
|
import { visualizer } from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/rollup-plugin-visualizer@5.12.0_rollup@4.9.6/node_modules/rollup-plugin-visualizer/dist/plugin/index.js";
|
||
|
import Components from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/unplugin-vue-components@0.26.0_rollup@4.9.6_vue@3.4.15/node_modules/unplugin-vue-components/dist/vite.js";
|
||
|
import AutoImport from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/unplugin-auto-import@0.17.5_@vueuse+core@10.7.2_rollup@4.9.6/node_modules/unplugin-auto-import/dist/vite.js";
|
||
|
import VueRouter from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/unplugin-vue-router@0.7.0_rollup@4.9.6_vue-router@4.2.5_vue@3.4.15/node_modules/unplugin-vue-router/dist/vite.mjs";
|
||
|
import { VueRouterAutoImports } from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/unplugin-vue-router@0.7.0_rollup@4.9.6_vue-router@4.2.5_vue@3.4.15/node_modules/unplugin-vue-router/dist/index.mjs";
|
||
|
import { VantResolver } from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/unplugin-vue-components@0.26.0_rollup@4.9.6_vue@3.4.15/node_modules/unplugin-vue-components/dist/resolvers.js";
|
||
|
import { unheadVueComposablesImports } from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/@unhead+vue@1.8.10_vue@3.4.15/node_modules/@unhead/vue/dist/index.mjs";
|
||
|
import VueDevTools from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/vite-plugin-vue-devtools@7.0.14_rollup@4.9.6_vite@5.0.12/node_modules/vite-plugin-vue-devtools/dist/vite.mjs";
|
||
|
import mockDevServerPlugin from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/vite-plugin-mock-dev-server@1.4.7_rollup@4.9.6_vite@5.0.12/node_modules/vite-plugin-mock-dev-server/dist/index.js";
|
||
|
import UnoCSS from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/unocss@0.58.5_rollup@4.9.6_vite@5.0.12/node_modules/unocss/dist/vite.mjs";
|
||
|
|
||
|
// build/vite/vconsole.ts
|
||
|
import path from "node:path";
|
||
|
import { viteVConsole } from "file:///E:/web_project/sn-huiyi-h5/node_modules/.pnpm/vite-plugin-vconsole@2.1.1/node_modules/vite-plugin-vconsole/dist/main.mjs";
|
||
|
function createViteVConsole() {
|
||
|
return viteVConsole({
|
||
|
entry: [path.resolve("src/main.ts")],
|
||
|
enabled: false,
|
||
|
config: {
|
||
|
maxLogNumber: 1e3,
|
||
|
theme: "light"
|
||
|
},
|
||
|
// https://github.com/vadxq/vite-plugin-vconsole/issues/21
|
||
|
// dynamicConfig: {
|
||
|
// theme: `document.documentElement.classList.contains('dark') ? 'dark' : 'light'`,
|
||
|
// },
|
||
|
eventListener: `
|
||
|
const targetElement = document.querySelector('html'); // \u62E9\u8981\u76D1\u542C\u7684\u5143\u7D20
|
||
|
const observerOptions = {
|
||
|
attributes: true, // \u76D1\u542C\u5C5E\u6027\u53D8\u5316
|
||
|
attributeFilter: ['class'] // \u53EA\u76D1\u542Cclass\u5C5E\u6027\u53D8\u5316
|
||
|
};
|
||
|
|
||
|
// \u5B9A\u4E49\u56DE\u8C03\u51FD\u6570\u6765\u5904\u7406\u89C2\u5BDF\u5230\u7684\u53D8\u5316
|
||
|
function handleAttributeChange(mutationsList) {
|
||
|
for(let mutation of mutationsList) {
|
||
|
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
||
|
if (window && window.vConsole) {
|
||
|
window.vConsole.dynamicChange.value = new Date().getTime();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// \u521B\u5EFA\u89C2\u5BDF\u8005\u5B9E\u4F8B\u5E76\u4F20\u5165\u56DE\u8C03\u51FD\u6570
|
||
|
const observer = new MutationObserver(handleAttributeChange);
|
||
|
|
||
|
// \u5F00\u59CB\u89C2\u5BDF\u76EE\u6807\u5143\u7D20
|
||
|
observer.observe(targetElement, observerOptions);
|
||
|
|
||
|
// \u5F53\u4E0D\u518D\u9700\u8981\u89C2\u5BDF\u65F6\uFF0C\u505C\u6B62\u89C2\u5BDF
|
||
|
// observer.disconnect();
|
||
|
`
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// build/vite/index.ts
|
||
|
function createVitePlugins() {
|
||
|
return [
|
||
|
VueRouter({
|
||
|
routesFolder: "src/views",
|
||
|
dts: "src/typed-router.d.ts"
|
||
|
}),
|
||
|
vue(),
|
||
|
vueJsx(),
|
||
|
visualizer(),
|
||
|
UnoCSS(),
|
||
|
mockDevServerPlugin(),
|
||
|
legacy({
|
||
|
targets: ["defaults", "not IE 11"]
|
||
|
}),
|
||
|
Components({
|
||
|
extensions: ["vue"],
|
||
|
resolvers: [VantResolver()],
|
||
|
include: [/\.vue$/, /\.vue\?vue/],
|
||
|
dts: "src/components.d.ts"
|
||
|
}),
|
||
|
AutoImport({
|
||
|
include: [
|
||
|
/\.[tj]sx?$/,
|
||
|
/\.vue$/,
|
||
|
/\.vue\?vue/
|
||
|
],
|
||
|
imports: [
|
||
|
"vue",
|
||
|
"vitest",
|
||
|
"@vueuse/core",
|
||
|
VueRouterAutoImports,
|
||
|
{
|
||
|
"vue-router/auto": ["useLink"]
|
||
|
},
|
||
|
unheadVueComposablesImports
|
||
|
],
|
||
|
dts: "src/auto-imports.d.ts",
|
||
|
dirs: [
|
||
|
"src/composables"
|
||
|
]
|
||
|
}),
|
||
|
createViteVConsole(),
|
||
|
VueDevTools()
|
||
|
];
|
||
|
}
|
||
|
|
||
|
// vite.config.ts
|
||
|
var __vite_injected_original_dirname = "E:\\web_project\\sn-huiyi-h5";
|
||
|
var vite_config_default = ({ mode }) => {
|
||
|
const root = process.cwd();
|
||
|
const env = loadEnv(mode, root);
|
||
|
return {
|
||
|
base: env.VITE_APP_PUBLIC_PATH,
|
||
|
plugins: createVitePlugins(),
|
||
|
server: {
|
||
|
host: true,
|
||
|
port: 3e3,
|
||
|
proxy: {
|
||
|
"/api": {
|
||
|
// 接口请求地址
|
||
|
// target: 'http://localhost:8888/api',
|
||
|
target: "https://jihui.huiyipro.com/api",
|
||
|
changeOrigin: true,
|
||
|
rewrite: (path3) => path3.replace(/^\/api/, "")
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
resolve: {
|
||
|
alias: {
|
||
|
"~@": path2.join(__vite_injected_original_dirname, "./src"),
|
||
|
"@": path2.join(__vite_injected_original_dirname, "./src"),
|
||
|
"~": path2.join(__vite_injected_original_dirname, "./src/assets")
|
||
|
}
|
||
|
},
|
||
|
css: {
|
||
|
postcss: {
|
||
|
plugins: [
|
||
|
autoprefixer(),
|
||
|
viewport({
|
||
|
appSelector: "#app",
|
||
|
viewportWidth: 375,
|
||
|
maxDisplayWidth: 600
|
||
|
})
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
build: {
|
||
|
cssCodeSplit: false,
|
||
|
chunkSizeWarningLimit: 2048
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
export {
|
||
|
vite_config_default as default
|
||
|
};
|
||
|
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiLCAiYnVpbGQvdml0ZS9pbmRleC50cyIsICJidWlsZC92aXRlL3Zjb25zb2xlLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZGlybmFtZSA9IFwiRTpcXFxcd2ViX3Byb2plY3RcXFxcc24taHVpeWktaDVcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIkU6XFxcXHdlYl9wcm9qZWN0XFxcXHNuLWh1aXlpLWg1XFxcXHZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9FOi93ZWJfcHJvamVjdC9zbi1odWl5aS1oNS92aXRlLmNvbmZpZy50c1wiO2ltcG9ydCBwYXRoIGZyb20gJ25vZGU6cGF0aCdcbmltcG9ydCBwcm9jZXNzIGZyb20gJ25vZGU6cHJvY2VzcydcbmltcG9ydCB7IGxvYWRFbnYgfSBmcm9tICd2aXRlJ1xuaW1wb3J0IHR5cGUgeyBDb25maWdFbnYsIFVzZXJDb25maWcgfSBmcm9tICd2aXRlJ1xuaW1wb3J0IHZpZXdwb3J0IGZyb20gJ3Bvc3Rjc3MtbW9iaWxlLWZvcmV2ZXInXG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