forked from PolymerLabs/arcs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
77 lines (74 loc) · 2.06 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
77
/**
* @license
* Copyright 2019 Google LLC.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* Code distributed by Google as part of this project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
import resolve from 'rollup-plugin-node-resolve';
import multiEntry from 'rollup-plugin-multi-entry';
import ignore from 'rollup-plugin-ignore';
import pkg from './package.json';
import path from 'path';
import typescript from 'rollup-plugin-typescript2';
import commonjs from 'rollup-plugin-commonjs';
const defaults = {compilerOptions: {declaration: true}};
export default [{
input: ['build/runtime/runtime.js',
'build/runtime/keymgmt/manager.js',
'shells/planner-shell/planner-shell.js'],
output: [
{
file: pkg.main,
format: 'es',
}
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
plugins: [
ignore(['whatwg-fetch']),
{
resolveId: (importee, importer) => {
if (importee.includes('-web.js')) {
return path.resolve(path.dirname(importer), importee.replace('-web.js', '-node.js'));
}
// if nothing is returned, we fall back to default resolution
}
},
resolve({jsnext: true, module: false, modulesOnly: true}),
commonjs(),
multiEntry()
]
},
{
input: ['src/runtime/webmain.ts'],
output: [
{
file: pkg.browser,
format: 'esm',
}
],
plugins: [
typescript(
{
tsConfigDefaults: defaults,
tsconfig: 'tsconfig.json'
}),
ignore(['whatwg-fetch']),
{
resolveId: (importee, importer) => {
if (importee.includes('-node.js')) {
return path.resolve(path.dirname(importer), importee.replace('-node.js', '-web.js'));
}
// if nothing is returned, we fall back to default resolution
}
},
resolve({browser: true}),
commonjs(),
multiEntry()
]
}];