Skip to content

Commit d63c882

Browse files
committed
build: update config
1 parent 4b31755 commit d63c882

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

rollup.config.js

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,61 @@
1-
import babel from 'rollup-plugin-babel'
2-
import { terser } from 'rollup-plugin-terser'
3-
import nodent from 'rollup-plugin-nodent'
4-
import license from 'rollup-plugin-license'
5-
import copy from 'rollup-plugin-copy'
6-
import { nodeResolve } from '@rollup/plugin-node-resolve'
7-
import commonjs from '@rollup/plugin-commonjs'
8-
import path from 'path'
1+
import babel from 'rollup-plugin-babel';
2+
import { terser } from 'rollup-plugin-terser';
3+
import nodent from 'rollup-plugin-nodent';
4+
import license from 'rollup-plugin-license';
5+
import copy from 'rollup-plugin-copy';
6+
import { nodeResolve } from '@rollup/plugin-node-resolve';
7+
import commonjs from '@rollup/plugin-commonjs';
8+
import path from 'path';
9+
10+
const pkg = require('./package.json');
911

10-
const pkg = require('./package.json')
1112
const notExternal = [
12-
// 'pako',
1313
'uzip',
14-
'bowser',
15-
]
16-
const external = Object.keys(pkg.dependencies).filter(value => !notExternal.includes(value))
14+
];
15+
const external = Object.keys(pkg.dependencies).filter((value) => !notExternal.includes(value));
1716

18-
let plugins = [
17+
const plugins = [
1918
nodent({ noRuntime: true, promises: true }),
2019
babel(),
2120
terser({
2221
keep_fnames: true,
23-
mangle: { reserved: ['CustomFile', 'CustomFileReader', 'UPNG', 'UZIP', 'bowser'] }
22+
mangle: { reserved: ['CustomFile', 'CustomFileReader', 'UPNG', 'UZIP'] },
2423
}),
2524
license({
2625
sourcemap: true,
2726
banner: '<%= _.startCase(pkg.name) %>\nv<%= pkg.version %>\nby <%= pkg.author %>\n<%= pkg.repository.url %>',
2827
}),
2928
copy({
3029
targets: [
31-
{ src: 'lib/index.d.ts', dest: path.dirname(pkg.types) , rename: path.basename(pkg.types) }
32-
]
30+
{ src: 'lib/index.d.ts', dest: path.dirname(pkg.types), rename: path.basename(pkg.types) },
31+
],
3332
}),
3433
nodeResolve(),
35-
commonjs()
36-
]
34+
commonjs(),
35+
];
3736

3837
export default {
3938
input: 'lib/index.js',
40-
plugins: plugins,
41-
external: external,
39+
plugins,
40+
external,
4241
output: [
4342
{
4443
file: pkg.main,
4544
name: 'imageCompression',
4645
format: 'umd',
4746
sourcemap: true,
4847
globals: {
49-
// pako: 'pako',
5048
uzip: 'UZIP',
51-
bowser: 'bowser'
52-
}
49+
},
5350
},
5451
{
5552
file: pkg.module,
5653
format: 'es',
5754
sourcemap: true,
5855
globals: {
59-
// pako: 'pako',
6056
uzip: 'UZIP',
61-
bowser: 'bowser'
62-
}
57+
},
6358
},
6459

65-
]
66-
}
60+
],
61+
};

0 commit comments

Comments
 (0)