forked from DevExpress/testcafe-hammerhead
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
47 lines (41 loc) · 1.41 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
import path from 'path';
import resolve from '@rollup/plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import commonjs from '@rollup/plugin-commonjs';
const TARGET_DIR = 'lib/client';
const CHUNKS = [
{ input: 'src/client/index.ts', output: 'hammerhead.js' },
{ input: 'src/client/transport-worker/index.ts', output: 'transport-worker.js' },
{ input: 'src/client/worker/index.ts', output: 'worker-hammerhead.js' }
];
const CONFIG = CHUNKS.map(chunk => ({
input: chunk.input,
output: {
file: path.join(TARGET_DIR, chunk.output),
format: 'iife',
// NOTE: 'use strict' in our scripts can break user code
// https://github.com/DevExpress/testcafe/issues/258
strict: false
},
plugins: [
resolve(),
typescript({
tsconfig: 'src/client/tsconfig.json',
include: [
'src/**/*.ts',
// NOTE: transpile the acorn-hammerhead package because it has non-ES5 compatible code
'node_modules/acorn-hammerhead/**/*.js'
],
rollupCommonJSResolveHack: true
}),
commonjs()
],
onwarn (warning, rollupWarn) {
if (warning.code === 'CIRCULAR_DEPENDENCY')
return;
if (warning.code === 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT')
return;
rollupWarn(warning);
}
}));
export default CONFIG;