Skip to content

Commit d68bb95

Browse files
committed
configure rollup to generate multiple bundles
1 parent f1e0744 commit d68bb95

File tree

4 files changed

+31
-15
lines changed

4 files changed

+31
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ node_modules/
77
.cache
88
dist
99
*.lock
10+
!rollup.config.js

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"scripts": {
1010
"prepack": "npm run build",
1111
"postpublish": "npm run clean",
12-
"build": "npm run clean && rollup -c rollup.config.ts",
13-
"clean": "trash '**/*.js' '**/*.js.map' '**/*.d.ts' '!**/node_modules/**/*'",
12+
"build": "npm run clean && rollup -c rollup.config.js",
13+
"clean": "trash '**/*.js' '**/*.js.map' '**/*.d.ts' '!**/node_modules/**/*' '!rollup.config.js'",
1414
"fmt": "prettier --list-different --write --ignore-path .gitignore '**/*.{js,ts}'",
1515
"anim": "parcel internal/animate/testing/index.html --open",
1616
"test": "jest"

rollup.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import typescript from "rollup-plugin-typescript2";
2+
import {uglify} from "rollup-plugin-uglify";
3+
4+
const bundles = [
5+
{
6+
entry: "legacy/blobs.ts",
7+
output: "index.js",
8+
},
9+
{
10+
entry: "legacy/blobs.ts",
11+
output: "v1/index.js",
12+
},
13+
{
14+
entry: "public/gen.ts",
15+
output: "v2/gen.js",
16+
},
17+
];
18+
19+
export default bundles.map((bundle) => ({
20+
input: bundle.entry,
21+
output: {
22+
file: bundle.output,
23+
format: "umd",
24+
name: "blobs",
25+
sourcemap: true,
26+
},
27+
plugins: [typescript({cacheRoot: "./node_modules/.cache/rpt2"}), uglify()],
28+
}));

rollup.config.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)