generated from dev-protocol/clubs-plugin-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
84 lines (81 loc) · 1.43 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
83
84
import { dirname, relative, resolve } from 'path'
import typescript from '@rollup/plugin-typescript'
import { dts } from 'rollup-plugin-dts'
const dir = 'dist'
const dirPluginHelper = 'dist/plugin-helper'
const useSrc = ({ dir: _dir, ext } = {}) => ({
name: 'local:useSrc',
resolveId(source, importer) {
if (ext.some((e) => source.endsWith(e))) {
const from = _dir ?? dirname(importer)
const importerDir = dirname(importer)
const original = resolve(importerDir, source)
const relativePath = relative(from, original)
return {
id: relativePath,
external: true,
}
}
},
})
export default [
{
input: 'src/index.ts',
output: [
{
dir,
format: 'es',
},
],
plugins: [
typescript(),
useSrc({
ext: [
'.astro',
'.svelte',
'.vue',
'.scss',
'.css',
'.jpg',
'.png',
'.svg',
],
dir,
}),
],
},
{
input: 'src/plugin-helper/index.ts',
output: [
{
dir: dirPluginHelper,
format: 'es',
},
],
plugins: [typescript({ compilerOptions: { outDir: dirPluginHelper } })],
},
{
input: 'dist/src/index.d.ts',
output: [
{
file: 'dist/index.d.ts',
format: 'es',
},
],
plugins: [dts()],
},
{
input: 'dist/plugin-helper/src/plugin-helper/index.d.ts',
output: [
{
file: 'dist/plugin-helper/index.d.ts',
format: 'es',
},
{
file: 'plugin-helper.d.ts',
format: 'es',
},
],
plugins: [dts()],
},
]