generated from dev-protocol/template-repos-ts
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
36 lines (33 loc) · 734 Bytes
/
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
import { dirname, relative, resolve } from 'path'
import typescript from '@rollup/plugin-typescript'
const dir = 'dist'
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'], dir }),
],
},
]