forked from kaisermann/svelte-i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
41 lines (37 loc) · 1 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
import commonjs from 'rollup-plugin-commonjs';
import ts from 'rollup-plugin-typescript2';
import { terser } from 'rollup-plugin-terser';
import autoExternal from 'rollup-plugin-auto-external';
import pkg from './package.json';
const PROD = !process.env.ROLLUP_WATCH;
export default [
{
input: 'src/runtime/index.ts',
external: [
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
'svelte/store',
],
output: [
{ file: pkg.module, format: 'es' },
{ file: pkg.main, format: 'cjs' },
],
plugins: [commonjs(), autoExternal(), ts(), PROD && terser()],
},
{
input: 'src/cli/index.ts',
// external: id => {
// if (id.startsWith('/')) return false
// return externals.has(id) || id.match(/svelte/gi)
// },
output: [
{
file: pkg.bin['svelte-i18n'],
name: 'cli.js',
format: 'cjs',
banner: `#!/usr/bin/env node`,
},
],
plugins: [autoExternal(), commonjs(), ts()],
},
];