Showing
4 changed files
with
25 additions
and
8 deletions
| ... | @@ -39,6 +39,7 @@ | ... | @@ -39,6 +39,7 @@ |
| 39 | "sass-embedded": "1.55.0", | 39 | "sass-embedded": "1.55.0", |
| 40 | "unplugin-vue-components": "^0.27.4", | 40 | "unplugin-vue-components": "^0.27.4", |
| 41 | "vite": "^5.4.1", | 41 | "vite": "^5.4.1", |
| 42 | + "vite-plugin-commonjs": "^0.10.3", | ||
| 42 | "vite-plugin-dynamic-import": "^1.5.0" | 43 | "vite-plugin-dynamic-import": "^1.5.0" |
| 43 | } | 44 | } |
| 44 | } | 45 | } | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2024-08-26 10:12:56 | 2 | * @Date: 2024-08-26 10:12:56 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-09-30 09:58:00 | 4 | + * @LastEditTime: 2024-10-15 13:49:56 |
| 5 | * @FilePath: /hager/vite.config.js | 5 | * @FilePath: /hager/vite.config.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -13,7 +13,7 @@ import { defineConfig, loadEnv } from 'vite'; | ... | @@ -13,7 +13,7 @@ import { defineConfig, loadEnv } from 'vite'; |
| 13 | import { createProxy } from './build/proxy'; | 13 | import { createProxy } from './build/proxy'; |
| 14 | import Components from 'unplugin-vue-components/vite'; | 14 | import Components from 'unplugin-vue-components/vite'; |
| 15 | import { ElementUiResolver } from 'unplugin-vue-components/resolvers'; | 15 | import { ElementUiResolver } from 'unplugin-vue-components/resolvers'; |
| 16 | - | 16 | +import commonjs from 'vite-plugin-commonjs'; |
| 17 | 17 | ||
| 18 | // var path = require('path'); | 18 | // var path = require('path'); |
| 19 | import path from 'path-browserify'; | 19 | import path from 'path-browserify'; |
| ... | @@ -57,6 +57,7 @@ return defineConfig({ | ... | @@ -57,6 +57,7 @@ return defineConfig({ |
| 57 | Components({ // 自动按需求引入组件 | 57 | Components({ // 自动按需求引入组件 |
| 58 | resolvers: [ElementUiResolver()], | 58 | resolvers: [ElementUiResolver()], |
| 59 | }), | 59 | }), |
| 60 | + commonjs(), // 将 CommonJS 模块转换为 ES Modules | ||
| 60 | ], | 61 | ], |
| 61 | publicDir: 'public', // 作为静态资源服务的文件夹。这个目录中的文件会在开发中被服务于 /,在开发模式时,会被拷贝到 outDir 的根目录,并没有转换,永远只是复制到这里。该值可以是文件系统的绝对路径,也可以是相对于项目的根目录路径。 | 62 | publicDir: 'public', // 作为静态资源服务的文件夹。这个目录中的文件会在开发中被服务于 /,在开发模式时,会被拷贝到 outDir 的根目录,并没有转换,永远只是复制到这里。该值可以是文件系统的绝对路径,也可以是相对于项目的根目录路径。 |
| 62 | // cacheDir: '', // 存储缓存文件的目录。此目录下会存储预打包的依赖项或 vite 生成的某些缓存文件,使用缓存可以提高性能。如需重新生成缓存文件,你可以使用 --force 命令行选项或手动删除目录。此选项的值可以是文件的绝对路径,也可以是以项目根目录为基准的相对路径。 | 63 | // cacheDir: '', // 存储缓存文件的目录。此目录下会存储预打包的依赖项或 vite 生成的某些缓存文件,使用缓存可以提高性能。如需重新生成缓存文件,你可以使用 --force 命令行选项或手动删除目录。此选项的值可以是文件的绝对路径,也可以是以项目根目录为基准的相对路径。 | ... | ... |
| ... | @@ -1595,7 +1595,7 @@ es-errors@^1.3.0: | ... | @@ -1595,7 +1595,7 @@ es-errors@^1.3.0: |
| 1595 | resolved "https://mirrors.cloud.tencent.com/npm/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" | 1595 | resolved "https://mirrors.cloud.tencent.com/npm/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" |
| 1596 | integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== | 1596 | integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== |
| 1597 | 1597 | ||
| 1598 | -es-module-lexer@^1.2.1: | 1598 | +es-module-lexer@^1.2.1, es-module-lexer@^1.5.4: |
| 1599 | version "1.5.4" | 1599 | version "1.5.4" |
| 1600 | resolved "https://mirrors.cloud.tencent.com/npm/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" | 1600 | resolved "https://mirrors.cloud.tencent.com/npm/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" |
| 1601 | integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== | 1601 | integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== |
| ... | @@ -1855,11 +1855,6 @@ json5@^2.2.3: | ... | @@ -1855,11 +1855,6 @@ json5@^2.2.3: |
| 1855 | resolved "https://mirrors.cloud.tencent.com/npm/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" | 1855 | resolved "https://mirrors.cloud.tencent.com/npm/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" |
| 1856 | integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== | 1856 | integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== |
| 1857 | 1857 | ||
| 1858 | -kolorist@^1.8.0: | ||
| 1859 | - version "1.8.0" | ||
| 1860 | - resolved "https://mirrors.cloud.tencent.com/npm/kolorist/-/kolorist-1.8.0.tgz#edddbbbc7894bc13302cdf740af6374d4a04743c" | ||
| 1861 | - integrity sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ== | ||
| 1862 | - | ||
| 1863 | less@^4.2.0: | 1858 | less@^4.2.0: |
| 1864 | version "4.2.0" | 1859 | version "4.2.0" |
| 1865 | resolved "https://mirrors.cloud.tencent.com/npm/less/-/less-4.2.0.tgz#cbefbfaa14a4cd388e2099b2b51f956e1465c450" | 1860 | resolved "https://mirrors.cloud.tencent.com/npm/less/-/less-4.2.0.tgz#cbefbfaa14a4cd388e2099b2b51f956e1465c450" |
| ... | @@ -2469,6 +2464,15 @@ update-browserslist-db@^1.1.0: | ... | @@ -2469,6 +2464,15 @@ update-browserslist-db@^1.1.0: |
| 2469 | escalade "^3.1.2" | 2464 | escalade "^3.1.2" |
| 2470 | picocolors "^1.0.1" | 2465 | picocolors "^1.0.1" |
| 2471 | 2466 | ||
| 2467 | +vite-plugin-commonjs@^0.10.3: | ||
| 2468 | + version "0.10.3" | ||
| 2469 | + resolved "https://mirrors.cloud.tencent.com/npm/vite-plugin-commonjs/-/vite-plugin-commonjs-0.10.3.tgz#e75abb1586464be9d216c829fc250df23a8542e7" | ||
| 2470 | + integrity sha512-trtH4dfAqrbqwiUhSKcqrfjnlXnqLHdIbYuUy943y34JnDjIX8qlpExP0nFN+kE2s6/BS6r9d1cAHS0KtiF4yQ== | ||
| 2471 | + dependencies: | ||
| 2472 | + acorn "^8.12.1" | ||
| 2473 | + magic-string "^0.30.11" | ||
| 2474 | + vite-plugin-dynamic-import "^1.6.0" | ||
| 2475 | + | ||
| 2472 | vite-plugin-dynamic-import@^1.5.0: | 2476 | vite-plugin-dynamic-import@^1.5.0: |
| 2473 | version "1.5.0" | 2477 | version "1.5.0" |
| 2474 | resolved "https://mirrors.cloud.tencent.com/npm/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.5.0.tgz#a28f4768da977f0e448009489617aec259180b63" | 2478 | resolved "https://mirrors.cloud.tencent.com/npm/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.5.0.tgz#a28f4768da977f0e448009489617aec259180b63" |
| ... | @@ -2479,6 +2483,16 @@ vite-plugin-dynamic-import@^1.5.0: | ... | @@ -2479,6 +2483,16 @@ vite-plugin-dynamic-import@^1.5.0: |
| 2479 | fast-glob "^3.2.12" | 2483 | fast-glob "^3.2.12" |
| 2480 | magic-string "^0.30.1" | 2484 | magic-string "^0.30.1" |
| 2481 | 2485 | ||
| 2486 | +vite-plugin-dynamic-import@^1.6.0: | ||
| 2487 | + version "1.6.0" | ||
| 2488 | + resolved "https://mirrors.cloud.tencent.com/npm/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.6.0.tgz#c9680b2093fc897721fe535202acc8af77537ae4" | ||
| 2489 | + integrity sha512-TM0sz70wfzTIo9YCxVFwS8OA9lNREsh+0vMHGSkWDTZ7bgd1Yjs5RV8EgB634l/91IsXJReg0xtmuQqP0mf+rg== | ||
| 2490 | + dependencies: | ||
| 2491 | + acorn "^8.12.1" | ||
| 2492 | + es-module-lexer "^1.5.4" | ||
| 2493 | + fast-glob "^3.3.2" | ||
| 2494 | + magic-string "^0.30.11" | ||
| 2495 | + | ||
| 2482 | vite@^5.4.1: | 2496 | vite@^5.4.1: |
| 2483 | version "5.4.2" | 2497 | version "5.4.2" |
| 2484 | resolved "https://mirrors.cloud.tencent.com/npm/vite/-/vite-5.4.2.tgz#8acb6ec4bfab823cdfc1cb2d6c53ed311bc4e47e" | 2498 | resolved "https://mirrors.cloud.tencent.com/npm/vite/-/vite-5.4.2.tgz#8acb6ec4bfab823cdfc1cb2d6c53ed311bc4e47e" | ... | ... |
-
Please register or login to post a comment