Files
halo/ui/packages/editor/vite.config.ts
Ryan Wang a204fbc86a Refactor editor package (#7968)
* Move extensions

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Refactor editor extensions to use explicit naming

* Refactor attachment selector integration in editor

* Remove vue-demi from Vite external dependencies

* Add README for richtext-editor package

* Refactor attachment composable and update upload permissions

* Refactor editor i18n keys and move upload strings

* Refactor AllExtensions to ExtensionsKit and update usage

* Move heading id attribute to extension implementation

* Refactor i18n usage to use i18n.global.t

* Update README to reflect changes in editor extensions, replacing AllExtensions with ExtensionsKit

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
2025-11-28 13:02:34 +08:00

72 lines
1.8 KiB
TypeScript

import { fileURLToPath, URL } from "node:url";
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
import Vue from "@vitejs/plugin-vue";
import path from "node:path";
import Icons from "unplugin-icons/vite";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
export default ({ mode }: { mode: string }) => {
const isProduction = mode === "production";
return defineConfig({
experimental: {
enableNativePlugin: true,
},
plugins: [
Vue(),
Icons({
compiler: "vue3",
}),
isProduction &&
dts({
tsconfigPath: "./tsconfig.app.json",
entryRoot: "./src",
outDir: "./dist",
insertTypesEntry: true,
}),
VueI18nPlugin({
include: [path.resolve(__dirname, "./src/locales/*.yaml")],
}),
],
define: {
"process.env.NODE_ENV": '"production"',
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
build: {
outDir: path.resolve(__dirname, "dist"),
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "RichTextEditor",
formats: ["es", "iife"],
fileName: (format) => `index.${format}.js`,
cssFileName: "style",
},
minify: isProduction,
rollupOptions: {
external: [
"vue",
"@halo-dev/ui-shared",
"@halo-dev/api-client",
"@halo-dev/components",
],
output: {
globals: {
vue: "Vue",
"@halo-dev/ui-shared": "HaloUiShared",
"@halo-dev/api-client": "HaloApiClient",
"@halo-dev/components": "HaloComponents",
},
exports: "named",
},
},
sourcemap: false,
},
});
};