generated from archoleat/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
43 lines (41 loc) · 1.03 KB
/
rollup.config.ts
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 { resolve } from 'node:path';
import { defineConfig } from 'rollup';
import { dts } from 'rollup-plugin-dts';
import { minify } from 'rollup-plugin-esbuild';
import alias from '@rollup/plugin-alias';
import typescript from '@rollup/plugin-typescript';
const sourceFolder = 'src';
const validatorsFolder = `${sourceFolder}/validators`;
const fileFormat = 'es';
const fileName = 'index';
const declarationFile = `${fileName}.d.ts`;
const entryFile = `${fileName}.ts`;
const outputFile = `${fileName}.js`;
export default defineConfig([
{
plugins: [typescript(), minify()],
input: `${sourceFolder}/${entryFile}`,
output: {
file: outputFile,
format: fileFormat,
},
},
{
plugins: [
alias({
entries: [
{
find: '#validators',
replacement: resolve(`${validatorsFolder}/${entryFile}`),
},
],
}),
dts(),
],
input: `${sourceFolder}/${entryFile}`,
output: {
file: declarationFile,
format: fileFormat,
},
},
]);