-
Notifications
You must be signed in to change notification settings - Fork 26
/
rollup.config.ts
55 lines (52 loc) · 1.72 KB
/
rollup.config.ts
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
import rollupPluginTypescript2 from 'rollup-plugin-typescript2';
const packageJson = require(`${process.env.PWD}/package.json`);
const external = [
...Object.keys(packageJson.dependencies || {}),
];
export default [
{
external,
input: 'src/index.ts', // our source file
output: [
{
file: packageJson.main, // main
format: "cjs", // CommonJS , uses require etc, suitable for Node and other bundlers (alias: commonjs)
sourcemap: true,
},
{
file: packageJson.es2015,
format: 'esm', // Keep the bundle as an ES module file
sourcemap: true,
},
],
plugins: [
rollupPluginTypescript2({
typescript: require('typescript'),
}),
// terser() // minifies generated bundles
],
},
// to make a es5 bundle
// https://github.com/stereobooster/package.json#package-bundlers
// module has import and export, but none of the other new stuff
// have to taget es5 right now because angular7 uses es5, revist in angular9
// todo: revist when angular 9
{
external,
input: 'src/index.ts', // our source file
output: [
{
file: packageJson.module,
format: 'es', // Keep the bundle as an ES module file
sourcemap: true,
},
],
plugins: [
rollupPluginTypescript2({
typescript: require('typescript'),
tsconfigOverride: { compilerOptions: { target: "es5" } },
}),
// terser() // minifies generated bundles
],
},
];