mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 06:31:13 +00:00
Add a new Vite path alias '@/napcat-image-size' in packages/napcat-schema/vite.config.ts pointing to ../napcat-image-size. This enables cleaner imports of the napcat-image-size package from within napcat-schema source files.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import path, { resolve } from 'path';
|
|
import { builtinModules } from 'module';
|
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
import napcatVersion from 'napcat-vite/vite-plugin-version';
|
|
// 依赖排除
|
|
const external = [
|
|
'ws',
|
|
'express',
|
|
'electron'
|
|
];
|
|
const nodeModules = [...builtinModules, builtinModules.map((m) => `node:${m}`)].flat();
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
conditions: ['node', 'default'],
|
|
alias: {
|
|
'@/napcat-onebot': resolve(__dirname, '../napcat-onebot'),
|
|
'@/napcat-common': resolve(__dirname, '../napcat-common'),
|
|
'@/napcat-schema': resolve(__dirname, './src'),
|
|
'@/napcat-core': resolve(__dirname, '../napcat-core'),
|
|
'@/napcat-webui-backend': resolve(__dirname, '../napcat-webui-backend'),
|
|
'@/napcat-image-size': resolve(__dirname, '../napcat-image-size'),
|
|
},
|
|
},
|
|
plugins: [
|
|
nodeResolve(),
|
|
napcatVersion()
|
|
],
|
|
build: {
|
|
target: 'esnext',
|
|
minify: false,
|
|
emptyOutDir: true,
|
|
outDir: 'dist',
|
|
lib: {
|
|
entry: path.resolve(__dirname, './index.ts'),
|
|
formats: ['es'],
|
|
fileName: () => 'schemas.mjs',
|
|
},
|
|
rollupOptions: {
|
|
external: [
|
|
...nodeModules,
|
|
...external
|
|
]
|
|
},
|
|
},
|
|
});
|