-
Notifications
You must be signed in to change notification settings - Fork 262
/
rollup-browser-tests.config.js
57 lines (52 loc) · 1.33 KB
/
rollup-browser-tests.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 fetch from 'node-fetch';
import graphqlCompiler from 'rollup-plugin-graphql-js-client-compiler';
import nodeResolve from 'rollup-plugin-node-resolve';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
import babel from 'rollup-plugin-babel';
import remap from 'rollup-plugin-remap';
import baseConfig from './rollup-tests-common.config';
const {livereloadPort} = require('./package.json');
const reloadUri = `http://localhost:${livereloadPort}/changed?files=tests.js,index.html`;
baseConfig.plugins.unshift(
graphqlCompiler({
schema: './schema.json'
})
);
baseConfig.plugins.push(
remap({
originalPath: './test/isomorphic-fetch-mock.js',
targetPath: './test/fetch-mock-browser.js'
}),
globals(),
builtins(),
nodeResolve({
jsnext: true,
main: true,
preferBuiltins: false
}),
babel({
babelrc: false,
presets: [
[`${process.cwd()}/node_modules/babel-preset-env/lib/index`, {
targets: {
browsers: ['last 2 versions']
},
modules: false
}]
],
plugins: [
`${process.cwd()}/node_modules/babel-plugin-external-helpers/lib/index`
]
}),
{
onwrite() {
fetch(reloadUri);
}
}
);
baseConfig.targets = [{
format: 'iife',
dest: '.tmp/test/tests.js'
}];
export default baseConfig;