Merge pull request #25 from ruibaby/chore/simplify-bundler-config
chore: simplify bundler config
This commit is contained in:
commit
f9007864b6
|
@ -20,6 +20,7 @@
|
|||
"vue": "^3.3.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@halo-dev/ui-plugin-bundler-kit": "^2.12.0",
|
||||
"@iconify/json": "^2.2.76",
|
||||
"@rushstack/eslint-patch": "^1.3.1",
|
||||
"@types/canvas-confetti": "^1.6.0",
|
||||
|
|
|
@ -28,6 +28,9 @@ dependencies:
|
|||
version: 3.3.12(typescript@4.7.4)
|
||||
|
||||
devDependencies:
|
||||
'@halo-dev/ui-plugin-bundler-kit':
|
||||
specifier: ^2.12.0
|
||||
version: 2.12.0(vite@3.2.7)
|
||||
'@iconify/json':
|
||||
specifier: ^2.2.76
|
||||
version: 2.2.159
|
||||
|
@ -595,6 +598,15 @@ packages:
|
|||
vue-router: 4.2.5(vue@3.3.12)
|
||||
dev: false
|
||||
|
||||
/@halo-dev/ui-plugin-bundler-kit@2.12.0(vite@3.2.7):
|
||||
resolution: {integrity: sha512-3558qzH5RN9pB2j0ZonuIxX3cw8lh870cWpPPHjkDxTIjKt+aO5tjKhcqKlFL853jdx9nHIIS+nMDCeqjejpxw==}
|
||||
engines: {node: ^18.0.0 || >=20.0.0}
|
||||
peerDependencies:
|
||||
vite: ^4.0.0 || ^5.0.0
|
||||
dependencies:
|
||||
vite: 3.2.7(@types/node@16.18.68)(sass@1.69.5)
|
||||
dev: true
|
||||
|
||||
/@humanwhocodes/config-array@0.11.13:
|
||||
resolution: {integrity: sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==}
|
||||
engines: {node: '>=10.10.0'}
|
||||
|
|
|
@ -4,58 +4,19 @@ import { defineConfig } from "vite";
|
|||
import Vue from "@vitejs/plugin-vue";
|
||||
import VueJsx from "@vitejs/plugin-vue-jsx";
|
||||
import Icons from "unplugin-icons/vite";
|
||||
|
||||
const pluginEntryName = "vditor-mde";
|
||||
import { HaloUIPluginBundlerKit } from "@halo-dev/ui-plugin-bundler-kit";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default ({ mode }: { mode: string }) => {
|
||||
const isProduction = mode === "production";
|
||||
const outDir = isProduction
|
||||
? "../src/main/resources/console"
|
||||
: "../build/resources/main/console";
|
||||
|
||||
return defineConfig({
|
||||
plugins: [Vue(),VueJsx(), Icons({ compiler: "vue3" })],
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
Vue(),
|
||||
VueJsx(),
|
||||
Icons({ compiler: "vue3" }),
|
||||
HaloUIPluginBundlerKit(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
},
|
||||
},
|
||||
define: {
|
||||
"process.env": process.env,
|
||||
},
|
||||
build: {
|
||||
outDir,
|
||||
emptyOutDir: true,
|
||||
lib: {
|
||||
entry: "src/index.ts",
|
||||
name: pluginEntryName,
|
||||
formats: ["iife"],
|
||||
fileName: () => "main.js",
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [
|
||||
"vue",
|
||||
"vue-router",
|
||||
"@vueuse/core",
|
||||
"@vueuse/components",
|
||||
"@vueuse/router",
|
||||
"@halo-dev/shared",
|
||||
"@halo-dev/components",
|
||||
],
|
||||
output: {
|
||||
globals: {
|
||||
vue: "Vue",
|
||||
"vue-router": "VueRouter",
|
||||
"@vueuse/core": "VueUse",
|
||||
"@vueuse/components": "VueUse",
|
||||
"@vueuse/router": "VueUse",
|
||||
"@halo-dev/console-shared": "HaloConsoleShared",
|
||||
"@halo-dev/components": "HaloComponents",
|
||||
},
|
||||
extend: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue