-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrollup.config.js
34 lines (31 loc) · 954 Bytes
/
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
import fs from "fs";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import typescript from "rollup-plugin-typescript";
let bundles = [];
const packages = fs.readdirSync("./packages");
for (const pkg of packages) {
// browser-friendly UMD build
bundles.push({
input: `packages/${pkg}/src/index.ts`,
output: {
name: `@tokenwrap/${pkg}`,
file: `bundles/@tokenwrap/${pkg}.js`,
format: "umd",
globals: packages.reduce(
(a, p) =>
Object.assign(a, {
[`@tokenwrap/${p}`]: `@tokenwrap/${p}`
}),
{}
)
},
external: packages.map(p => `@tokenwrap/${p}`),
plugins: [
resolve(), // so Rollup can find node_modules
commonjs(), // so Rollup can convert node_modules to ES modules
typescript({ declarationMap: false }) // so Rollup can convert TypeScript to JS
]
});
}
export default bundles;