-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.ts
102 lines (101 loc) · 2.86 KB
/
rollup.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { defineConfig } from 'rollup'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import typescript from 'rollup-plugin-typescript2'
import commonjs from '@rollup/plugin-commonjs'
import postcss from 'rollup-plugin-postcss'
import VueJsx from '@vitejs/plugin-vue-jsx'
import alias from '@rollup/plugin-alias'
import copy from 'rollup-plugin-copy'
import Vue from '@vitejs/plugin-vue'
/**
* Rollup Configuration
*/
export default defineConfig([
{
input: [
'src/core/S-EditCell/input.tsx',
'src/core/S-EditCell/select.tsx',
'src/core/S-EditCell/textarea.tsx',
'src/core/S-EditCell/tree-select.tsx',
'src/core/S-EditCell/select-icon.tsx',
'src/core/S-EditCell/date-picker.tsx',
'src/core/S-EditCell/auto-complete.tsx',
'src/core/S-IconSelect/index.tsx',
'src/core/S-ProLayout/index.tsx',
'src/core/S-Ellipsis/index.tsx',
'src/core/S-Table/index.tsx',
'src/core/S-Tree/index.tsx',
'src/core/S-Form/index.tsx',
'src/core/S-Icon/index.tsx',
'src/core/resolver.ts',
'src/core/helper.ts',
'src/core/index.ts',
],
output: [
{
dir: 'dist',
format: 'es',
hoistTransitiveImports: false,
chunkFileNames: `chunk-[name].mjs`,
entryFileNames: chunk => {
const id = chunk.facadeModuleId
const dir = id?.replace(/.+\/src\/core\/(([^./]+)\/)?[^./]+(\.vue|\.tsx|\.ts)/, '$2')
return dir ? `${dir}/[name].mjs` : `[name].mjs`
},
},
{
dir: 'dist',
format: 'cjs',
exports: 'named',
hoistTransitiveImports: false,
chunkFileNames: `chunk-[name].cjs`,
entryFileNames: chunk => {
const id = chunk.facadeModuleId
const dir = id?.replace(/.+\/src\/core\/(([^./]+)\/)?[^./]+(\.vue|\.tsx|\.ts)/, '$2')
return dir ? `${dir}/[name].cjs` : `[name].cjs`
},
paths: id => {
return id.replace('ant-design-vue/es/', 'ant-design-vue/lib/')
},
},
],
plugins: [
alias({
entries: [{
find: '@',
replacement: new URL('./src/core', import.meta.url).pathname,
}],
}),
commonjs(),
nodeResolve(),
typescript({
check: false,
include: ['src/core/**/*.ts?(x)'],
exclude: [
'src/core/**/_.tsx',
'src/core/**/*.d.ts',
'src/core/**/def.*.tsx',
],
}),
copy({
targets: [{
dest: ['dist'],
src: ['src/typing/*'],
}],
expandDirectories: false,
}),
Vue(),
VueJsx(),
postcss(),
],
external: [
/^vue(\/.+|$)/,
/^dayjs(\/.+|$)/,
/^vue-types(\/.+|$)/,
/^vue-router(\/.+|$)/,
/^ant-design-vue(\/.+|$)/,
/^@ant-design\/icons-vue(\/.+|$)/,
/^@ctrl\/tinycolor(\/.+|$)/,
],
},
])