-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
rollup.config.js
78 lines (78 loc) · 2.62 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* @description :
* @author : Marco Lima
* @group :
* @created :
*
* MODIFICATION LOG
* - Version : 0.2.6
* - Date : 14/11/2024
* - Author : Cassio Seffrin
* - Modification :
**/
import alias from '@rollup/plugin-alias';
import typescript from 'rollup-plugin-typescript2';
import { terser } from 'rollup-plugin-terser';
import json from '@rollup/plugin-json';
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import copy from 'rollup-plugin-copy';
import path from 'path';
export default {
input: 'src/index.ts',
output: [
// {
// dir: 'dist/esm',
// format: 'esm',
// sourcemap: true,
// compact: true,
// },
{
dir: 'dist/cjs',
format: 'cjs',
sourcemap: true,
compact: true,
inlineSources: true,
},
],
external: ['fs', 'path', 'https', 'url', 'crypto', 'bwip-js', 'xsd-schema-validator', 'pdfkit', 'pem', 'libxmljs'],
plugins: [
alias({
entries: [
{ find: '@Classes', replacement: path.resolve(__dirname, 'src/classes') },
{ find: '@Controllers', replacement: path.resolve(__dirname, 'src/controllers') },
{ find: '@Protocols', replacement: path.resolve(__dirname, 'src/protocols') },
{ find: '@Protocols', replacement: path.resolve(__dirname, 'src/protocols/index') },
{ find: '@Utils', replacement: path.resolve(__dirname, 'src/utils') },
],
}),
json(),
nodeResolve(),
commonjs(),
typescript({
tsconfig: "tsconfig.json",
sourceMap: true,
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
preventAssignment: true,
}),
copy({
targets: [
// ESM
// { src: 'src/assets/*', dest: 'dist/esm/assets' },
// { src: 'src/certs/*', dest: 'dist/esm/certs' },
// { src: 'src/schemas/*', dest: 'dist/esm/schemas' },
// CJS
{ src: 'src/assets/*', dest: 'dist/cjs/assets' },
{ src: 'src/certs/*', dest: 'dist/cjs/certs' },
{ src: 'src/schemas/*', dest: 'dist/cjs/schemas' },
],
}),
terser({
keep_fnames: true,
mangle: false,
}),
],
};