-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.js
76 lines (73 loc) · 1.79 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
72
73
74
75
76
import babel from 'rollup-plugin-babel';
import sourcemaps from 'rollup-plugin-sourcemaps';
import { terser } from "rollup-plugin-terser";
function searchAndReplace() {
return ['search-and-replace', {
rules: [{
search: './worker.ts',
replace: './worker.js',
}]
}];
}
/**
* Both Babel and Rollup have features to combine the source maps of two consecutive transformations. It is therefore
* important not to use both. Luckily, we can set Babel’s `inputSourceMap` option to false, in order to make Babel
* ignore the source maps in src/target/js that were created by the TypeScript compiler.
*/
const inputSourceMap = false;
export default [
{
input: 'target/js/umd/index.js',
output: {
file: 'dist/index.js',
format: 'umd',
name: 'ProjectPlanningJs',
sourcemap: true,
sourcemapExcludeSources: true,
},
plugins: [
sourcemaps(),
babel({
inputSourceMap,
presets: ['@babel/preset-env'],
plugins: ['babel-plugin-unassert']
}),
],
},
{
input: 'target/js/umd/index.js',
output: {
file: 'dist/index.min.js',
format: 'umd',
name: 'ProjectPlanningJs',
sourcemap: true,
sourcemapExcludeSources: true,
},
plugins: [
sourcemaps(),
babel({
inputSourceMap,
presets: ['@babel/preset-env'],
plugins: ['babel-plugin-unassert']
}),
terser(),
],
},
{
input: ['target/js/index.js', 'target/js/worker.js'],
output: {
dir: 'dist/es6/',
format: 'esm',
sourcemap: true,
sourcemapExcludeSources: true,
},
preserveModules: true,
plugins: [
sourcemaps(),
babel({
inputSourceMap,
plugins: ['babel-plugin-unassert', searchAndReplace()],
}),
],
},
];