-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
49 lines (45 loc) · 1.12 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
import { defineConfig } from 'rollup';
import json from '@rollup/plugin-json';
import typescript from 'rollup-plugin-typescript2';
import esbuild from 'rollup-plugin-esbuild';
import { typescriptPaths } from 'rollup-plugin-typescript-paths';
import replace from '@rollup/plugin-replace';
import size from 'rollup-plugin-size';
import rimraf from '@zkochan/rimraf';
import { isDevelopment } from 'std-env';
await rimraf('dist/*');
/** @type {import('rollup').Plugin[]} */
const plugins = [
json(),
typescript(),
typescriptPaths(),
esbuild({
target: 'node20',
jsx: 'transform',
minifySyntax: !isDevelopment,
minifyIdentifiers: !isDevelopment,
loaders: {
'.js': 'jsx',
'.ts': 'tsx',
}
}),
size()
];
if (isDevelopment) {
plugins.push(
replace({
'process.env.NODE_ENV': '\'development\'',
preventAssignment: true
})
);
}
export default defineConfig([
{
input: 'src/index.ts',
output: {
file: 'dist/index.js',
format: 'es'
},
plugins
}
]);