mirror of
https://gitee.com/bootx/dax-pay-ui.git
synced 2025-09-06 04:09:36 +00:00
feat: 逐步抽离部分包到packages
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
"sass": "^1.60.0",
|
||||
"unocss": "^0.50.6",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-dts": "^2.2.0",
|
||||
"vite-plugin-html": "^3.2.0",
|
||||
"vite-plugin-mock": "^2.9.6",
|
||||
"vite-plugin-purge-icons": "^0.9.2",
|
||||
|
@@ -1,5 +1,39 @@
|
||||
function definePackageConfig() {
|
||||
// TODO:
|
||||
import { type UserConfig, defineConfig, mergeConfig } from 'vite';
|
||||
import { readPackageJSON } from 'pkg-types';
|
||||
import { commonConfig } from './common';
|
||||
import dts from 'vite-plugin-dts';
|
||||
|
||||
interface DefineOptions {
|
||||
overrides?: UserConfig;
|
||||
options?: {};
|
||||
}
|
||||
|
||||
function definePackageConfig(defineOptions: DefineOptions = {}) {
|
||||
const { overrides = {} } = defineOptions;
|
||||
const root = process.cwd();
|
||||
return defineConfig(async () => {
|
||||
const { dependencies = {}, peerDependencies = {} } = await readPackageJSON(root);
|
||||
const packageConfig: UserConfig = {
|
||||
build: {
|
||||
lib: {
|
||||
entry: 'src/index.ts',
|
||||
formats: ['es'],
|
||||
fileName: () => 'index.mjs',
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...Object.keys(dependencies), ...Object.keys(peerDependencies)],
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
dts({
|
||||
logLevel: 'error',
|
||||
}),
|
||||
],
|
||||
};
|
||||
const mergedConfig = mergeConfig(commonConfig, packageConfig);
|
||||
|
||||
return mergeConfig(mergedConfig, overrides);
|
||||
});
|
||||
}
|
||||
|
||||
export { definePackageConfig };
|
||||
|
@@ -1 +1,2 @@
|
||||
export * from './config/application';
|
||||
export * from './config/package';
|
||||
|
Reference in New Issue
Block a user