Repository navigation
Expand file tree
/
Copy pathrollup.config.js
More file actions
56 lines (53 loc) · 1.51 KB
/
Copy pathrollup.config.js
File metadata and controls
56 lines (53 loc) · 1.51 KB
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
import typescript from 'rollup-plugin-typescript2'
import resolve from 'rollup-plugin-node-resolve'
import svelte from 'rollup-plugin-svelte';
import pkg from './package.json'
import * as path from 'path'
let externalModules = pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : []
let plugins = [
svelte({
include: 'src/components/**/*.html',
}),
typescript({
typescript: require('typescript'),
useTsconfigDeclarationDir: true
}),
resolve(),
]
export default [{
input: 'src/index.ts',
output: [{
file: pkg.main,
format: 'cjs',
}],
external: (id) => [...externalModules, "./svelte-helpers", "./dom", "./components"].some( prefix => id.startsWith(prefix)),
plugins: plugins
},
{
input: 'src/dom/index.ts',
output: [{
file: path.dirname(pkg.main)+"/dom/index.js",
format: 'cjs',
}],
external: (id) => [...externalModules, "../svelte-helpers/", "../components/"].some( prefix => id.startsWith(prefix)),
plugins: plugins
},
{
input: 'src/svelte-helpers/index.ts',
output: [{
file: path.dirname(pkg.main)+"/svelte-helpers/index.js",
format: 'cjs',
}],
external: (id) => [...externalModules, "../dom", "../components"].some( prefix => id.startsWith(prefix)),
plugins: plugins
},
{
input: 'src/components/index.ts',
output: [{
file: path.dirname(pkg.main)+"/components/index.js",
format: 'cjs',
}],
external: (id) => [...externalModules, "../dom", "../svelte-helpers"].some( prefix => id.startsWith(prefix)),
plugins: plugins
},
];