|
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'); |
9 | 11 |
|
10 | | -const pkg = require('./package.json') |
11 | 12 | const notExternal = [ |
12 | | - // 'pako', |
13 | 13 | '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)); |
17 | 16 |
|
18 | | -let plugins = [ |
| 17 | +const plugins = [ |
19 | 18 | nodent({ noRuntime: true, promises: true }), |
20 | 19 | babel(), |
21 | 20 | terser({ |
22 | 21 | keep_fnames: true, |
23 | | - mangle: { reserved: ['CustomFile', 'CustomFileReader', 'UPNG', 'UZIP', 'bowser'] } |
| 22 | + mangle: { reserved: ['CustomFile', 'CustomFileReader', 'UPNG', 'UZIP'] }, |
24 | 23 | }), |
25 | 24 | license({ |
26 | 25 | sourcemap: true, |
27 | 26 | banner: '<%= _.startCase(pkg.name) %>\nv<%= pkg.version %>\nby <%= pkg.author %>\n<%= pkg.repository.url %>', |
28 | 27 | }), |
29 | 28 | copy({ |
30 | 29 | 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 | + ], |
33 | 32 | }), |
34 | 33 | nodeResolve(), |
35 | | - commonjs() |
36 | | -] |
| 34 | + commonjs(), |
| 35 | +]; |
37 | 36 |
|
38 | 37 | export default { |
39 | 38 | input: 'lib/index.js', |
40 | | - plugins: plugins, |
41 | | - external: external, |
| 39 | + plugins, |
| 40 | + external, |
42 | 41 | output: [ |
43 | 42 | { |
44 | 43 | file: pkg.main, |
45 | 44 | name: 'imageCompression', |
46 | 45 | format: 'umd', |
47 | 46 | sourcemap: true, |
48 | 47 | globals: { |
49 | | - // pako: 'pako', |
50 | 48 | uzip: 'UZIP', |
51 | | - bowser: 'bowser' |
52 | | - } |
| 49 | + }, |
53 | 50 | }, |
54 | 51 | { |
55 | 52 | file: pkg.module, |
56 | 53 | format: 'es', |
57 | 54 | sourcemap: true, |
58 | 55 | globals: { |
59 | | - // pako: 'pako', |
60 | 56 | uzip: 'UZIP', |
61 | | - bowser: 'bowser' |
62 | | - } |
| 57 | + }, |
63 | 58 | }, |
64 | 59 |
|
65 | | - ] |
66 | | -} |
| 60 | + ], |
| 61 | +}; |
0 commit comments