-
Notifications
You must be signed in to change notification settings - Fork 152
/
rollup.config.js
57 lines (55 loc) · 1.35 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
import commonjs from '@rollup/plugin-commonjs';
import nodePolyfills from 'rollup-plugin-node-polyfills';
import resolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import replace from '@rollup/plugin-replace';
import { env } from 'process';
const isTest262 = !!env.TEST262;
const libName = 'temporal';
const babelConfig = {
exclude: 'node_modules/**',
babelHelpers: 'bundled',
presets: [
[
'@babel/preset-env',
{
targets: '> 0.25%, not dead'
}
]
]
};
const replaceConfig = { exclude: 'node_modules/**', preventAssignment: true };
const resolveConfig = { preferBuiltins: false };
export default [
{
input: 'lib/shim.mjs',
plugins: [
replace({ ...replaceConfig, __debug__: false, __isTest262__: isTest262 }),
commonjs(),
nodePolyfills(),
resolve(resolveConfig)
],
output: {
name: libName,
file: 'script.js',
format: 'iife',
sourcemap: true
}
},
!isTest262 && {
input: 'lib/shim.mjs',
output: {
name: libName,
file: '../out/docs/playground.js',
format: 'umd',
sourcemap: true
},
plugins: [
replace({ ...replaceConfig, __debug__: true, __isTest262__: false }),
commonjs(),
nodePolyfills(),
resolve(resolveConfig),
babel(babelConfig)
]
}
].filter(Boolean);