-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
33 lines (28 loc) · 898 Bytes
/
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
import commonjs from 'rollup-plugin-commonjs';
import typescript from 'rollup-plugin-typescript';
import resolve from 'rollup-plugin-node-resolve';
import pkg from './package.json';
import execute from 'rollup-plugin-command';
const name = 'zip-tap';
const sourcemap = true;
const prod = process.env.NODE_ENV === 'production';
const runningTests = process.env.NODE_ENV === 'test';
const watching = process.env.ROLLUP_WATCH;
const sharedOutputOptions = {
name,
sourcemap,
};
const output = [{ file: pkg.main, format: 'cjs', ...sharedOutputOptions }];
if (prod) output.push({ file: pkg.module, format: 'es', ...sharedOutputOptions });
export default {
input: prod ? 'src/index.ts' : 'test.ts',
output,
plugins: [
resolve(),
commonjs(),
!prod && !runningTests && execute(`node ${pkg.main}`, { exitOnFail: !watching }),
typescript({
typescript: require('typescript'),
}),
],
};