lizw 3 lat temu
rodzic
commit
722e3715f9
9 zmienionych plików z 1287 dodań i 0 usunięć
  1. 17 0
      .editorconfig
  2. 92 0
      .gitignore
  3. 11 0
      index.html
  4. 21 0
      package.json
  5. 5 0
      src/main.js
  6. 5 0
      src/module_1.js
  7. 6 0
      src/module_2.js
  8. 83 0
      vite.config.js
  9. 1047 0
      yarn.lock

+ 17 - 0
.editorconfig

@@ -0,0 +1,17 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+max_line_length = 180
+
+[*.md]
+trim_trailing_whitespace = false
+
+[Makefile]
+indent_style = tab

+ 92 - 0
.gitignore

@@ -0,0 +1,92 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# next.js build output
+.next
+
+# nuxt.js build output
+.nuxt
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
+
+# 自定义忽略文件
+.idea
+/dist
+/out
+/dll
+server/node_modules
+secret.txt
+!node_modules/react-split/index.d.ts
+/target
+.flattened-pom.xml
+*.iml

+ 11 - 0
index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="zh">
+<head>
+  <meta charset="UTF-8"/>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+</head>
+<body>
+<div id="root"></div>
+<script type="module" src="/src/main.js"></script>
+</body>
+</html>

+ 21 - 0
package.json

@@ -0,0 +1,21 @@
+{
+  "version": "0.0.1",
+  "scripts": {
+    "project-init": "yarn install",
+    "fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit",
+    "dev": "vite",
+    "serve": "vite preview",
+    "build": "vite build"
+  },
+  "dependencies": {
+  },
+  "devDependencies": {
+    "@types/node": "^14.18.13",
+    "less": "^4.1.2",
+    "less-loader": "^10.2.0",
+    "vite": "^2.9.4",
+    "vite-plugin-imp": "^2.1.7",
+    "@vitejs/plugin-legacy": "^1.5.2",
+    "rollup-plugin-amd": "^4.0.0"
+  }
+}

+ 5 - 0
src/main.js

@@ -0,0 +1,5 @@
+import { fun_a } from './module_1'
+import module_2 from "./module_2";
+
+console.log("module_1 ---> ", fun_a(1, 2));
+console.log("module_2 ---> ", module_2);

+ 5 - 0
src/module_1.js

@@ -0,0 +1,5 @@
+const fun_a = (a, b) => a + b;
+
+export {
+  fun_a,
+}

+ 6 - 0
src/module_2.js

@@ -0,0 +1,6 @@
+const value_b = {
+  num: 123,
+  str: "测试"
+}
+
+export default value_b;

+ 83 - 0
vite.config.js

@@ -0,0 +1,83 @@
+import { defineConfig } from "vite";
+import legacy from "@vitejs/plugin-legacy";
+import vitePluginImp from "vite-plugin-imp";
+const path = require("path");
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  // root: "./public/",
+  base: "./",
+  define: {
+    // isProdEnv: NODE_ENV === "production",
+    // apiGlobalPrefix: JSON.stringify(""),
+    // "process.env": "{}",
+  },
+  plugins: [
+    legacy({
+      targets: ["defaults", "not IE 11"],
+    }),
+    vitePluginImp({
+      libList: [
+        // { libName: "antd", style: name => `antd/es/${name}/style/index.css` },
+      ],
+    }),
+  ],
+  publicDir: "public",
+  resolve: {
+    alias: {
+      "~": path.resolve(__dirname, "./"),
+      "@": path.resolve(__dirname, "./src/"),
+    },
+  },
+  css: {
+    preprocessorOptions: {
+      less: {
+        javascriptEnabled: true,
+        modifyVars: {
+          // "white": "#3C3F41",
+          // "primary-color": "#3C3F41",
+        },
+      }
+    },
+    modules: {
+      localsConvention: "camelCaseOnly"
+    }
+  },
+  clearScreen: true,
+  server: {
+    host: "0.0.0.0",
+    port: 8000,
+    proxy: {
+      "/api/": {
+        target: "http://127.0.0.1:18081",
+        changeOrigin: true,
+        // rewrite: path => path,
+      },
+      "/api/ws/": {
+        target: "http://127.0.0.1:18081",
+        changeOrigin: true,
+        ws: true,
+      },
+    },
+    force: true,
+  },
+  build: {
+    target: "modules",
+    polyfillDynamicImport: false,
+    outDir: "dist",
+    assetsDir: "assets",
+    assetsInlineLimit: 4096,
+    cssCodeSplit: true,
+    rollupOptions: {
+      external: [],
+      plugins: [
+      ],
+      output: {
+        // name: name,
+        // exports: 'named',
+        // format: 'amd',
+        sourcemap: true,
+      },
+    },
+  },
+});

Plik diff jest za duży
+ 1047 - 0
yarn.lock