-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.js
More file actions
37 lines (34 loc) · 1017 Bytes
/
rollup.config.js
File metadata and controls
37 lines (34 loc) · 1017 Bytes
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
import { existsSync, readFileSync } from 'node:fs';
import { dirname } from 'node:path';
import typescript from '@rollup/plugin-typescript';
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
// Allow build to succeed as a no-op when guest-js/ hasn't been added yet
if (!existsSync('guest-js/index.ts')) {
// eslint-disable-next-line no-console
console.log('guest-js/index.ts not found — skipping build');
}
export default !existsSync('guest-js/index.ts') ? [] : {
input: 'guest-js/index.ts',
output: [
{
file: pkg.exports.import,
format: 'esm',
},
{
file: pkg.exports.require,
format: 'cjs',
},
],
plugins: [
typescript({
tsconfig: './guest-js/tsconfig.json',
declaration: true,
declarationDir: dirname(pkg.exports.import),
}),
],
external: [
/^@tauri-apps\/api/,
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
};