-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrollup.config.js
More file actions
37 lines (36 loc) · 1013 Bytes
/
Copy pathrollup.config.js
File metadata and controls
37 lines (36 loc) · 1013 Bytes
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
import terser from '@rollup/plugin-terser';
import copy from 'rollup-plugin-copy';
import esbuild from 'rollup-plugin-esbuild';
import pkg from './package.json';
export default [
{
input: 'lib/index.ts',
external: ['preact', 'preact/hooks'],
plugins: [
esbuild({
include: /\.[jt]sx?$/, // Transpile .js, .ts, .jsx, .tsx files
exclude: /node_modules/, // Exclude node_modules
sourceMap: true, // Generate source maps
minify: process.env.NODE_ENV === 'production', // Minify in production
target: 'es2015', // Target ES2015
}),
copy({
targets: [{ src: 'lib/package.json', dest: 'dist' }],
}),
terser(),
],
output: [
{
name: 'preactTranslate',
file: pkg.browser,
format: 'umd',
globals: {
preact: 'preact',
'preact/hooks': 'preact/hooks',
},
},
{ file: pkg.main, format: 'cjs' },
{ file: pkg.module, format: 'es' },
],
},
];