mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
49 lines
1004 B
TypeScript
49 lines
1004 B
TypeScript
import path from 'path'
|
|
import { epOutput } from './utils/paths'
|
|
import type { ModuleFormat } from 'rollup'
|
|
|
|
export const modules = ['esm', 'cjs'] as const
|
|
export type Module = typeof modules[number]
|
|
export interface BuildInfo {
|
|
module: 'ESNext' | 'CommonJS'
|
|
format: ModuleFormat
|
|
output: {
|
|
/** e.g: `es` */
|
|
name: string
|
|
/** e.g: `dist/element-plus/es` */
|
|
path: string
|
|
}
|
|
|
|
bundle: {
|
|
/** e.g: `element-plus/es` */
|
|
path: string
|
|
}
|
|
}
|
|
|
|
export const buildConfig: Record<Module, BuildInfo> = {
|
|
esm: {
|
|
module: 'ESNext',
|
|
format: 'esm',
|
|
output: {
|
|
name: 'es',
|
|
path: path.resolve(epOutput, 'es'),
|
|
},
|
|
bundle: {
|
|
path: 'element-plus/es',
|
|
},
|
|
},
|
|
cjs: {
|
|
module: 'CommonJS',
|
|
format: 'cjs',
|
|
output: {
|
|
name: 'lib',
|
|
path: path.resolve(epOutput, 'lib'),
|
|
},
|
|
bundle: {
|
|
path: 'element-plus/lib',
|
|
},
|
|
},
|
|
}
|
|
export type BuildConfig = typeof buildConfig
|
|
export type BuildConfigEntries = [Module, BuildInfo][]
|