Skip to content

Commit e8da1ce

Browse files
committed
chore(rollup): bundle tree
1 parent 7eebc75 commit e8da1ce

File tree

3 files changed

+95
-136
lines changed

3 files changed

+95
-136
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@stoplight/json": "^3.5.1",
4646
"@stoplight/json-schema-merge-allof": "^0.7.1",
4747
"@stoplight/react-error-boundary": "^1.0.0",
48-
"@stoplight/tree-list": "^5.0.0",
48+
"@stoplight/tree-list": "^5.0.1",
4949
"classnames": "^2.2.6",
5050
"lodash": "^4.17.15",
5151
"mobx-react-lite": "^1.4.1",
@@ -54,6 +54,8 @@
5454
"devDependencies": {
5555
"@emotion/core": "^10.0.16",
5656
"@emotion/styled": "^10.0.15",
57+
"@rollup/plugin-commonjs": "^11.1.0",
58+
"@rollup/plugin-typescript": "^3.1.1",
5759
"@sambego/storybook-state": "^1.3.6",
5860
"@stoplight/markdown-viewer": "^3.5.5",
5961
"@stoplight/scripts": "^8.2.0",
@@ -83,7 +85,7 @@
8385
"prettier": "^1.19.1",
8486
"react": "16.9.0",
8587
"react-dom": "16.9.0",
86-
"rollup-plugin-commonjs": "^10.1.0",
88+
"rollup-plugin-terser": "^5.3.0",
8789
"treeify": "^1.1.0",
8890
"ts-jest": "^24.0.2",
8991
"tslint": "^5.19.0",

rollup.config.js

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
1-
import config from '@stoplight/scripts/rollup.config';
2-
import commonjs from 'rollup-plugin-commonjs';
1+
import * as path from 'path';
2+
import typescript from '@rollup/plugin-typescript';
3+
import { terser } from 'rollup-plugin-terser';
4+
import commonjs from '@rollup/plugin-commonjs';
35

4-
config.plugins.push(commonjs());
6+
const BASE_PATH = process.cwd();
57

6-
export default config;
8+
const plugins = [
9+
typescript({
10+
tsconfig: path.resolve(BASE_PATH, 'tsconfig.build.json'),
11+
include: ['src/**/*.{ts,tsx}'],
12+
}),
13+
terser(),
14+
commonjs(),
15+
];
16+
17+
export default [
18+
{
19+
input: path.resolve(BASE_PATH, 'src/index.ts'),
20+
plugins,
21+
output: [
22+
{
23+
file: path.resolve(BASE_PATH, 'dist/index.cjs.js'),
24+
format: 'cjs',
25+
},
26+
{
27+
file: path.resolve(BASE_PATH, 'dist/index.es.js'),
28+
format: 'esm',
29+
},
30+
],
31+
},
32+
{
33+
input: path.resolve(BASE_PATH, 'src/tree/index.ts'),
34+
plugins,
35+
output: [
36+
{
37+
file: path.resolve(BASE_PATH, 'dist/tree/index.js'),
38+
format: 'esm',
39+
},
40+
],
41+
},
42+
];

0 commit comments

Comments
 (0)