-
Notifications
You must be signed in to change notification settings - Fork 52
/
rollup.config.js
71 lines (68 loc) · 1.63 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import babel from 'rollup-plugin-babel';
import { terser } from "rollup-plugin-terser";
import typescript from 'rollup-plugin-typescript2';
import hashbang from 'rollup-plugin-hashbang';
import sourceMaps from 'rollup-plugin-sourcemaps';
import commonjs from 'rollup-plugin-commonjs';
import pkg from './package.json';
const typescriptOptions = {
tsconfigOverride: {
compilerOptions: {
module: 'es2015',
declaration: false,
},
include: ['src'],
exclude: ['src/browser', 'src/cli'],
},
};
const babelOptions = {
babelHelpers: 'bundled',
extensions: ['.js', '.ts'],
};
export default [
// Browser UMD build
{
input: 'src/browser/index.ts',
output: { name: 'window', file: pkg.browser, format: 'umd', sourcemap: true, extend: true },
plugins: [
commonjs(),
typescript(typescriptOptions),
babel(babelOptions),
terser(),
sourceMaps(),
],
},
// Browser ESM module
{
input: 'src/browser/index.ts',
output: { file: pkg.module, format: 'esm', sourcemap: true },
plugins: [
commonjs(),
typescript(typescriptOptions),
terser(),
sourceMaps(),
],
},
// Node CLI bin transliteration file
{
input: 'src/cli/transliterate.ts',
output: { file: pkg.bin.transliterate, format: 'cjs' },
plugins: [
commonjs(),
typescript(typescriptOptions),
terser(),
hashbang(),
],
},
// Node CLI bin slugify file
{
input: 'src/cli/slugify.ts',
output: { file: pkg.bin.slugify, format: 'cjs' },
plugins: [
commonjs(),
typescript(typescriptOptions),
terser(),
hashbang(),
],
},
];