Pārlūkot izejas kodu

fix: 修复代码格式问题

louhangfei 2 gadi atpakaļ
vecāks
revīzija
29ac1ae9e6
2 mainītis faili ar 37 papildinājumiem un 37 dzēšanām
  1. 1 1
      build/script/buildConf.ts
  2. 36 36
      build/vite/plugin/html.ts

+ 1 - 1
build/script/buildConf.ts

@@ -15,7 +15,7 @@ function createConfig(
     configName,
     config,
     configFileName = GLOB_CONFIG_FILE_NAME,
-  }: { configName: string; config: any; configFileName?: string } = { configName: '', config: {} }
+  }: { configName: string; config: any; configFileName?: string } = { configName: '', config: {} },
 ) {
   try {
     const windowConf = `window.${configName}`;

+ 36 - 36
build/vite/plugin/html.ts

@@ -2,39 +2,39 @@
  * Plugin to minimize and use ejs template syntax in index.html.
  * https://github.com/anncwb/vite-plugin-html
  */
- import type { PluginOption } from 'vite';
- import { createHtmlPlugin } from 'vite-plugin-html';
- import pkg from '../../../package.json';
- import { GLOB_CONFIG_FILE_NAME } from '../../constant';
- 
- export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
-   const { VITE_GLOB_APP_TITLE, VITE_PUBLIC_PATH } = env;
- 
-   const path = VITE_PUBLIC_PATH.endsWith('/') ? VITE_PUBLIC_PATH : `${VITE_PUBLIC_PATH}/`;
- 
-   const getAppConfigSrc = () => {
-     return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`;
-   };
- 
-   const htmlPlugin: PluginOption[] = createHtmlPlugin({
-     minify: isBuild,
-     inject: {
-       // Inject data into ejs template
-       data: {
-         title: VITE_GLOB_APP_TITLE,
-       },
-       // Embed the generated app.config.js file
-       tags: isBuild
-         ? [
-             {
-               tag: 'script',
-               attrs: {
-                 src: getAppConfigSrc(),
-               },
-             },
-           ]
-         : [],
-     },
-   });
-   return htmlPlugin;
- }
+import type { PluginOption } from 'vite';
+import { createHtmlPlugin } from 'vite-plugin-html';
+import pkg from '../../../package.json';
+import { GLOB_CONFIG_FILE_NAME } from '../../constant';
+
+export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
+  const { VITE_GLOB_APP_TITLE, VITE_PUBLIC_PATH } = env;
+
+  const path = VITE_PUBLIC_PATH.endsWith('/') ? VITE_PUBLIC_PATH : `${VITE_PUBLIC_PATH}/`;
+
+  const getAppConfigSrc = () => {
+    return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`;
+  };
+
+  const htmlPlugin: PluginOption[] = createHtmlPlugin({
+    minify: isBuild,
+    inject: {
+      // Inject data into ejs template
+      data: {
+        title: VITE_GLOB_APP_TITLE,
+      },
+      // Embed the generated app.config.js file
+      tags: isBuild
+        ? [
+            {
+              tag: 'script',
+              attrs: {
+                src: getAppConfigSrc(),
+              },
+            },
+          ]
+        : [],
+    },
+  });
+  return htmlPlugin;
+}