svelte-i18n/rollup.config.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-11-07 16:02:07 +01:00
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';
2019-06-12 05:04:34 +02:00
2020-11-07 16:02:07 +01:00
import pkg from './package.json';
2019-06-12 05:04:34 +02:00
2020-11-07 16:02:07 +01:00
const PROD = !process.env.ROLLUP_WATCH;
2019-11-19 17:18:42 +01:00
2019-06-12 05:04:34 +02:00
export default [
2019-06-19 15:41:57 +02:00
{
input: 'src/runtime/index.ts',
2019-11-19 17:18:42 +01:00
external: [
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
'svelte/store',
],
2019-06-19 15:42:04 +02:00
output: [
2019-06-19 22:34:18 +02:00
{ file: pkg.module, format: 'es' },
2019-06-19 15:41:57 +02:00
{ file: pkg.main, format: 'cjs' },
2019-06-12 05:04:34 +02:00
],
2019-11-19 17:18:42 +01:00
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()],
2019-06-19 15:41:57 +02:00
},
2020-11-07 16:02:07 +01:00
];