Skip to content

Commit d601c09

Browse files
committed
chore(dev): faster rollup build
1 parent 82e1056 commit d601c09

1 file changed

Lines changed: 37 additions & 29 deletions

File tree

rollup.config.js

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,42 @@ import { terser } from 'rollup-plugin-terser'
55

66
const name = 'workfront-api'
77

8-
const umdOptions = (minify) => ({
9-
input: 'src/Api.ts',
10-
output: {
11-
file: minify ? `dist/${name}.umd.min.js` : `dist/${name}.umd.js`,
12-
format: 'umd',
13-
name: 'Workfront',
14-
sourcemap: true
8+
module.exports = [
9+
{
10+
input: 'src/Api.ts',
11+
output: [
12+
{
13+
file: `dist/${name}.es.js`,
14+
format: 'esm',
15+
sourcemap: true
16+
},
17+
{
18+
file: `dist/${name}.umd.js`,
19+
format: 'umd',
20+
name: 'Workfront',
21+
sourcemap: true
22+
},
23+
],
24+
plugins: [ typescript(), resolve(), commonjs() ]
1525
},
16-
plugins: [ typescript(), resolve(), commonjs(), minify ? terser() : undefined ],
17-
})
18-
const esOptions = () => ({
19-
input: 'src/Api.ts',
20-
output: {
21-
file: `dist/${name}.es.js`,
22-
format: 'esm',
23-
sourcemap: true
26+
{
27+
input: 'src/Api.ts',
28+
output: {
29+
file: `dist/${name}.umd.min.js`,
30+
format: 'umd',
31+
name: 'Wokfront',
32+
sourcemap: true
33+
},
34+
plugins: [ typescript(), resolve(), commonjs(), terser() ]
2435
},
25-
plugins: [ typescript(), resolve(), commonjs() ],
26-
})
27-
const cjsOptions = () => ({
28-
input: 'src/node.ts',
29-
output: {
30-
file: `dist/${name}.cjs.js`,
31-
format: 'cjs',
32-
sourcemap: true
33-
},
34-
plugins: [ typescript(), terser() ],
35-
external: ['form-data', 'isomorphic-fetch', 'workfront-api-constants']
36-
})
37-
38-
module.exports = [umdOptions(), esOptions(), umdOptions(true), cjsOptions()]
36+
{
37+
input: 'src/node.ts',
38+
output: {
39+
file: `dist/${name}.cjs.js`,
40+
format: 'cjs',
41+
sourcemap: true
42+
},
43+
plugins: [ typescript() ],
44+
external: ['form-data', 'isomorphic-fetch', 'workfront-api-constants']
45+
}
46+
]

0 commit comments

Comments
 (0)