Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 52 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import md5 from 'md5'; |
||
2 | import fs from 'fs-extra'; |
||
3 | import path from 'node:path'; |
||
4 | import babel from '@rollup/plugin-babel'; |
||
5 | import alias from '@rollup/plugin-alias'; |
||
6 | import filesize from 'rollup-plugin-filesize'; |
||
7 | import { terser } from 'rollup-plugin-terser'; |
||
8 | import commonjs from '@rollup/plugin-commonjs'; |
||
9 | import resolve from '@rollup/plugin-node-resolve'; |
||
10 | import outputManifest from 'rollup-plugin-output-manifest'; |
||
11 | |||
12 | export default { |
||
13 | input: 'builds/cdn.js', |
||
14 | output: { |
||
15 | format: 'umd', |
||
16 | sourcemap: true, |
||
17 | name: 'tall-toasts', |
||
18 | file: 'dist/js/tall-toasts.js' |
||
19 | }, |
||
20 | plugins: [ |
||
21 | resolve(), |
||
22 | commonjs({ |
||
23 | include: /node_modules\/(get-value|isobject|core-js)/ |
||
24 | }), |
||
25 | filesize(), |
||
26 | terser({ |
||
27 | mangle: false, |
||
28 | compress: { |
||
29 | drop_debugger: false |
||
30 | } |
||
31 | }), |
||
32 | babel({ |
||
33 | exclude: 'node_modules/**' |
||
34 | }), |
||
35 | alias({ |
||
36 | entries: [ |
||
37 | { find: '@', replacement: path.resolve('resources/js') } |
||
38 | ] |
||
39 | }), |
||
40 | |||
41 | outputManifest({ |
||
42 | serialize () { |
||
43 | const file = fs.readFileSync(path.resolve('dist/js/tall-toasts.js'), 'utf8'); |
||
44 | const hash = md5(file).substr(0, 20); |
||
45 | |||
46 | return JSON.stringify({ |
||
47 | '/tall-toasts.js': '/tall-toasts.js?id=' + hash |
||
48 | }); |
||
49 | } |
||
50 | }) |
||
51 | ] |
||
52 | }; |
||
53 |