瀏覽代碼

build: import babel

dongchengjie 1 年之前
父節點
當前提交
60fee2accb
共有 4 個文件被更改,包括 938 次插入87 次删除
  1. 7 0
      .babelrc
  2. 7 3
      package.json
  3. 912 83
      pnpm-lock.yaml
  4. 12 1
      vite.config.ts

+ 7 - 0
.babelrc

@@ -0,0 +1,7 @@
+{
+  "presets": [
+    "@babel/preset-env",
+    "@babel/preset-react",
+    "@babel/preset-typescript"
+  ]
+}

+ 7 - 3
package.json

@@ -38,7 +38,6 @@
     "meta-json-schema": "1.18.5-alpha",
     "monaco-editor": "^0.47.0",
     "monaco-yaml": "^5.1.1",
-    "types-pac": "^1.0.2",
     "nanoid": "^5.0.7",
     "react": "^18.3.1",
     "react-dom": "^18.3.1",
@@ -51,10 +50,15 @@
     "react-virtuoso": "^4.7.10",
     "recoil": "^0.7.7",
     "swr": "^1.3.0",
-    "tar": "^6.2.1"
+    "tar": "^6.2.1",
+    "types-pac": "^1.0.2"
   },
   "devDependencies": {
     "@actions/github": "^5.1.1",
+    "@babel/preset-env": "^7.24.6",
+    "@babel/preset-react": "^7.24.6",
+    "@babel/preset-typescript": "^7.24.6",
+    "@rollup/plugin-babel": "^6.0.4",
     "@tauri-apps/cli": "^1.5.13",
     "@types/fs-extra": "^9.0.13",
     "@types/js-cookie": "^3.0.6",
@@ -62,7 +66,7 @@
     "@types/react": "^18.3.1",
     "@types/react-dom": "^18.3.0",
     "@types/react-transition-group": "^4.4.10",
-    "@vitejs/plugin-react": "^4.2.1",
+    "@vitejs/plugin-react": "^4.3.0",
     "adm-zip": "^0.5.12",
     "cross-env": "^7.0.3",
     "fs-extra": "^11.2.0",

文件差異過大導致無法顯示
+ 912 - 83
pnpm-lock.yaml


+ 12 - 1
vite.config.ts

@@ -2,15 +2,26 @@ import { defineConfig } from "vite";
 import path from "path";
 import svgr from "vite-plugin-svgr";
 import react from "@vitejs/plugin-react";
+import { babel } from "@rollup/plugin-babel";
 import monacoEditor from "vite-plugin-monaco-editor";
 
-// https://vitejs.dev/config/
 export default defineConfig({
   root: "src",
   server: { port: 3000 },
   plugins: [
     svgr(),
     react(),
+    {
+      apply: "build", // apply only for build, not for serve
+      ...babel({
+        babelHelpers: "bundled",
+        extensions: [".js", ".jsx", ".ts", ".tsx"],
+        targets: {
+          edge: "109", // last version to support Windows 7
+          safari: "13", // macOS 10.15 Catalina
+        },
+      }),
+    },
     monacoEditor({
       languageWorkers: ["editorWorkerService", "typescript", "css"],
       customWorkers: [

部分文件因文件數量過多而無法顯示