generated from dev-protocol/template-repos-ts
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.ui.mjs
57 lines (53 loc) · 1.19 KB
/
rollup.config.ui.mjs
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
import { dts } from 'rollup-plugin-dts'
import commonjs from '@rollup/plugin-commonjs'
import { useSrc } from './rollup.config.mjs'
import tailwind from './rollup.plugin.tw.mjs'
import { globSync } from 'glob'
// import { litScss } from 'rollup-plugin-scss-lit'
const files = globSync('dist/src/ui/*/*.js')
const dfiles = globSync('dist/src/ui/*/*.d.ts')
const ext = ['.astro', '.vue', '.svelte', '.css', '.scss']
export const createOptions = (file) => ({
input: file,
external: [/.*webcomponents.*/],
output: [
{
file: file.replace('.js', '.mjs'),
format: 'es',
},
{
file: file.replace('.js', '.cjs'),
format: 'cjs',
},
],
plugins: [
commonjs(),
useSrc({ ext }),
tailwind({
include: 'ui/**/*',
}),
// litScss({
// minify: process.env.NODE_ENV === 'production',
// options: { loadPaths: ['node_modules'] }
// })
],
})
export default [
...files.map(createOptions),
...dfiles.map((input) => ({
input: input.replace('.js', '.d.ts'),
output: [
{
file: input.replace('.js', '.d.ts').replace('dist/src/', ''),
format: 'es',
},
],
plugins: [
dts(),
useSrc({
out: (importer) => importer.replace('dist/src/', ''),
ext,
}),
],
})),
]