generated from archoleat/repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
50 lines (43 loc) · 1.09 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
44
45
46
47
48
49
50
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 typesFolder = `${sourceFolder}/types`;
const fileFormat = 'es';
const fileName = 'index';
const declarationFile = `${fileName}.d.ts`;
const entryFile = `${fileName}.ts`;
const outputFile = `${fileName}.js`;
export default defineConfig([
{
external: ['@archoleat/notifier', '@archoleat/reglib', 'node:path'],
plugins: [typescript(), minify()],
input: `${sourceFolder}/${entryFile}`,
output: {
file: outputFile,
format: fileFormat,
},
},
{
plugins: [
alias({
entries: [
{
find: '#types',
replacement: resolve(`${typesFolder}/${entryFile}`),
},
],
}),
,
dts(),
],
input: `${sourceFolder}/${entryFile}`,
output: {
file: declarationFile,
format: fileFormat,
},
},
]);