forked from kaisermann/svelte-i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
45 lines (41 loc) · 1.02 KB
/
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
37
38
39
40
41
42
43
44
45
import { readFileSync } from 'fs';
import commonjs from '@rollup/plugin-commonjs';
import autoExternal from 'rollup-plugin-auto-external';
import dts from 'rollup-plugin-dts';
import esbuild from 'rollup-plugin-esbuild';
const pkg = JSON.parse(readFileSync('./package.json'));
const external = [
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
'svelte/compiler',
'svelte/store',
];
export default [
// bundle runtime
{
input: 'src/runtime/index.ts',
output: [{ file: pkg.main, format: 'es' }],
external,
plugins: [commonjs(), autoExternal(), esbuild()],
},
// bundle types for runtime
{
input: 'src/runtime/index.ts',
output: [{ file: pkg.types, format: 'es' }],
plugins: [dts()],
},
// build CLI
{
input: 'src/cli/index.ts',
output: [
{
file: pkg.bin['svelte-i18n'],
name: 'cli.js',
format: 'es',
banner: `#!/usr/bin/env node`,
},
],
external,
plugins: [autoExternal(), commonjs(), esbuild()],
},
];