-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
43 lines (40 loc) · 1.06 KB
/
rollup.config.mjs
File metadata and controls
43 lines (40 loc) · 1.06 KB
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
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { dts } from 'rollup-plugin-dts';
const modules = ['backend', 'jwt', 'mock'];
const plugins = [
typescript({
compilerOptions: {
noEmit: false,
declaration: true,
module: 'esnext',
rootDir: '.',
declarationDir: './build/types',
},
tslib: {},
exclude: ['**/*.test.*', 'test-helpers/**'],
}),
terser({
format: { ascii_only: true },
mangle: { properties: { regex: /^_/ } },
}),
];
export default [
{
input: Object.fromEntries(modules.map((module) => [module, `${module}/index.ts`])),
output: {
dir: 'build',
format: 'esm',
entryFileNames: '[name]/index.mjs',
paths: (p) => p.replace(/.+\/(jwt)$/, '$1/index.mjs'),
},
external: [/node:.*/, /\/jwt$/],
plugins,
},
...modules.map((module) => ({
input: `./build/types/${module}/index.d.ts`,
output: [{ file: `build/${module}/index.d.ts`, format: 'esm' }],
external: [/node:.*/],
plugins: [dts()],
})),
];