This repository has been archived by the owner on Aug 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
82 lines (81 loc) · 2.47 KB
/
rollup.config.js
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
import { defineConfig } from 'rollup'
import nodeResolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import postcss from 'rollup-plugin-postcss'
import babel from '@rollup/plugin-babel'
import alias from '@rollup/plugin-alias'
import vue from 'rollup-plugin-vue'
/**
* Rollup Configuration
*/
export default defineConfig([
{
input: [
'src/lib/S-Table/index.js',
'src/lib/S-Table/filter.js',
'src/lib/S-EditCell/Input.vue',
'src/lib/S-EditCell/Select.vue',
'src/lib/S-EditCell/Textarea.vue',
'src/lib/S-EditCell/DatePicker.vue',
'src/lib/S-EditCell/TreeSelect.vue',
'src/lib/S-IconSelect/index.vue',
'src/lib/S-Ellipsis/index.vue',
'src/lib/S-Form/initial.js',
'src/lib/S-Form/helper.js',
'src/lib/S-Form/index.vue',
'src/lib/S-Tree/index.vue',
'src/util/helper.js',
'src/util/base.js',
'src/index.js'
],
output: [
{
dir: 'dist',
format: 'es',
hoistTransitiveImports: false,
entryFileNames: chunk => {
const id = chunk.facadeModuleId
const dir = id.replace(/.+\/src\/(([^/]+)\/)?(([^./]+)\/)?[^./]+(\.js|\.vue)/, '$2')
const type = id.replace(/.+\/src\/(([^/]+)\/)?(([^./]+)\/)?[^./]+(\.js|\.vue)/, '$4')
return dir && type ? `${dir}/${type}/[name].mjs` : dir ? `${dir}/[name].mjs` : `[name].mjs`
},
chunkFileNames: `vendor/[name]-[hash].mjs`
},
{
dir: 'dist',
format: 'cjs',
exports: 'named',
hoistTransitiveImports: false,
entryFileNames: chunk => {
const id = chunk.facadeModuleId
const dir = id.replace(/.+\/src\/(([^/]+)\/)?(([^./]+)\/)?[^./]+(\.js|\.vue)/, '$2')
const type = id.replace(/.+\/src\/(([^/]+)\/)?(([^./]+)\/)?[^./]+(\.js|\.vue)/, '$4')
return dir && type ? `${dir}/${type}/[name].cjs` : dir ? `${dir}/[name].cjs` : `[name].cjs`
},
chunkFileNames: `vendor/[name]-[hash].cjs`
}
],
plugins: [
alias({
entries: [{
find: '@',
replacement: new URL('./src', import.meta.url).pathname
}]
}),
vue(),
postcss(),
babel({
babelHelpers: 'bundled',
extensions: ['.js', '.vue'],
exclude: /\/src\/util\/.+/
}),
nodeResolve(),
commonjs()
],
external: [
/^vue(\/.+|$)/,
/^moment(\/.+|$)/,
/^ant-design-vue(\/.+|$)/
]
}
])