generated from archoleat/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.ts
68 lines (66 loc) · 1.78 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { defineConfig } from 'rollup';
import { dts } from 'rollup-plugin-dts';
import { minify } from 'rollup-plugin-esbuild';
import { resolve } from 'node:path';
import alias from '@rollup/plugin-alias';
import copy from 'rollup-plugin-copy';
import typescript from '@rollup/plugin-typescript';
const destinationFolder = 'dist';
const sourceFolder = 'src';
const configFolder = `${sourceFolder}/config`;
const iconsFolder = `${sourceFolder}/icons`;
const typesFolder = `${sourceFolder}/data/types`;
const utilsFolder = `${sourceFolder}/utils`;
const helpersFolder = `${utilsFolder}/helpers`;
const fileFormat = 'es';
const fileName = 'index';
const declarationFile = `${fileName}.d.ts`;
const entryFile = `${fileName}.ts`;
const outputFile = `${fileName}.js`;
export default defineConfig([
{
external: ['chalk', 'node-notifier', 'node:path'],
plugins: [
copy({
targets: [{ src: iconsFolder, dest: destinationFolder }],
}),
typescript(),
minify(),
],
input: `${sourceFolder}/${entryFile}`,
output: {
file: `${destinationFolder}/${outputFile}`,
format: fileFormat,
},
},
{
plugins: [
alias({
entries: [
{
find: '#config',
replacement: resolve(`${configFolder}/`),
},
{
find: '#helpers',
replacement: resolve(`${helpersFolder}/`),
},
{
find: '#types',
replacement: resolve(`${typesFolder}/`),
},
{
find: '#utils',
replacement: resolve(`${utilsFolder}/`),
},
],
}),
dts(),
],
input: `${sourceFolder}/${entryFile}`,
output: {
file: `${destinationFolder}/${declarationFile}`,
format: fileFormat,
},
},
]);