-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrollup.config.js
More file actions
52 lines (49 loc) · 1.14 KB
/
rollup.config.js
File metadata and controls
52 lines (49 loc) · 1.14 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
import { readFileSync } from 'fs'
import { join, dirname } from 'path'
import { cwd } from 'process'
import typescript from '@rollup/plugin-typescript'
const pkg = JSON.parse(readFileSync(join(cwd(), 'package.json'), 'utf8'))
const outputDir = dirname(pkg.exports.import)
export default [
{
input: 'guest-js/index.ts',
output: [
{
file: pkg.exports.import,
format: 'esm'
},
{
file: pkg.exports.require,
format: 'cjs'
}
],
plugins: [
typescript({
declaration: true,
declarationDir: outputDir,
})
],
external: [
/^@tauri-apps\/api/,
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
]
},
{
input: 'guest-js/cli.ts',
output: {
file: './dist-js/cli.cjs',
format: 'cjs',
banner: '#!/usr/bin/env node'
},
plugins: [
typescript({
declaration: false,
})
],
external: [
'fs', 'path', 'os', 'child_process', 'stream', 'stream/promises', 'https', 'http', 'url', 'util', '7z-wasm',
...Object.keys(pkg.dependencies || {}),
]
}
]