mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
* 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>
72 lines
1.8 KiB
TypeScript
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,
|
|
},
|
|
});
|
|
};
|