Browse Source

docs: add some annotation

xiaoxian521 3 years ago
parent
commit
3981c63e24
6 changed files with 17 additions and 11 deletions
  1. 13 10
      index.html
  2. 1 0
      package-lock.json
  3. 2 1
      package.json
  4. BIN
      public/pay.jpg
  5. BIN
      public/wechat.jpg
  6. 1 0
      vite.config.ts

+ 13 - 10
index.html

@@ -82,6 +82,7 @@
       </div>
     </div>
     <script>
+      // 此代码仅用于开发环境的友好提示,项目打包前请去掉这段js代码 This code is only used as a friendly reminder of the development environment, please remove this js code before packaging the project
       window.onload = function () {
         (function () {
           const ua = navigator.userAgent.toLowerCase();
@@ -97,16 +98,18 @@
 
           const el = document.querySelector("._develop");
 
-          if (browser && version >= 90) {
-            let success =
-              document.createTextNode("当前浏览器版本很适合开发!!! 😃");
-            el.appendChild(success);
-          } else {
-            let warn = document.createTextNode(
-              "当前浏览器版本不适合开发,建议使用最新版本的谷歌或者火狐浏览器!!!😯"
-            );
-            el.appendChild(warn);
-            el.style.color = "red";
+          if (el) {
+            if (browser && version >= 90) {
+              let success =
+                document.createTextNode("当前浏览器版本很适合开发!!! 😃");
+              el.appendChild(success);
+            } else {
+              let warn = document.createTextNode(
+                "当前浏览器版本不适合开发,建议使用最新版本的谷歌或者火狐浏览器!!!😯"
+              );
+              el.appendChild(warn);
+              el.style.color = "red";
+            }
           }
           return Sys;
         })();

+ 1 - 0
package-lock.json

@@ -65,6 +65,7 @@
         "postcss": "^8.2.6",
         "postcss-import": "^14.0.0",
         "prettier": "^2.3.2",
+        "rimraf": "^3.0.2",
         "sass": "^1.38.0",
         "sass-loader": "^12.1.0",
         "typescript": "^4.2.4",

+ 2 - 1
package.json

@@ -5,7 +5,7 @@
   "scripts": {
     "dev": "cross-env --max_old_space_size=4096 vite",
     "serve": "cross-env --max_old_space_size=4096 vite",
-    "build": "cross-env vite build",
+    "build": "rimraf dist && cross-env vite build",
     "preview": "vite preview",
     "preview:build": "npm run build && vite preview",
     "lint": "eslint --ext .js,.jsx,.vue,.ts,.tsx src",
@@ -76,6 +76,7 @@
     "postcss": "^8.2.6",
     "postcss-import": "^14.0.0",
     "prettier": "^2.3.2",
+    "rimraf": "^3.0.2",
     "sass": "^1.38.0",
     "sass-loader": "^12.1.0",
     "typescript": "^4.2.4",

BIN
public/pay.jpg


BIN
public/wechat.jpg


+ 1 - 0
vite.config.ts

@@ -84,6 +84,7 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
       ]
     },
     build: {
+      sourcemap: false,
       brotliSize: false,
       // 消除打包大小超过500kb警告
       chunkSizeWarningLimit: 2000