-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
rete.config.ts
48 lines (45 loc) · 1.16 KB
/
rete.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
/* eslint-disable @typescript-eslint/naming-convention */
import replace from '@rollup/plugin-replace'
import vue3 from '@vitejs/plugin-vue'
import vue2 from '@vitejs/plugin-vue2'
import { ReteOptions } from 'rete-cli'
import pug from 'rollup-plugin-pug'
import scss from 'rollup-plugin-scss'
function getPlugins(vueVersion: 2 | 3): NonNullable<ReteOptions['plugins']> {
return [
replace({
values: {
'process.env.VUECOMPAT': `./vuecompat/${vueVersion === 2 ? 'vue2' : 'vue3'}`
},
preventAssignment: true
}),
pug({
pugRuntime: false
}),
// eslint-disable-next-line no-undef
vueVersion === 2 ? vue2() : vue3({ compiler: require('@vue/compiler-sfc') }),
scss({
insert: true
})
]
}
const vue3Config = {
output: '.',
plugins: getPlugins(3)
}
const vue2Config = {
output: 'vue2',
plugins: getPlugins(2)
}
export default <ReteOptions[]>[vue3Config, vue2Config].map(({ output, plugins }) => ({
input: 'src/index.ts',
output,
name: 'ReteVuePlugin',
globals: {
'rete': 'Rete',
'rete-area-plugin': 'ReteAreaPlugin',
'rete-render-utils': 'ReteRenderUtils',
'vue': 'Vue'
},
plugins
}))