Skip to content

Commit

Permalink
Merge pull request #25 from ruibaby/chore/simplify-bundler-config
Browse files Browse the repository at this point in the history
chore: simplify bundler config
  • Loading branch information
justice2001 authored Feb 6, 2024
2 parents 23cdb94 + 7eb9546 commit f900786
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 52 deletions.
1 change: 1 addition & 0 deletions console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions console/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 13 additions & 52 deletions console/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" })],
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,
},
},
export default defineConfig({
plugins: [
Vue(),
VueJsx(),
Icons({ compiler: "vue3" }),
HaloUIPluginBundlerKit(),
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
});
};
},
});

0 comments on commit f900786

Please sign in to comment.