This repository was archived by the owner on Dec 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
75 lines (68 loc) · 1.55 KB
/
rollup.config.js
File metadata and controls
75 lines (68 loc) · 1.55 KB
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
69
70
71
72
73
74
75
import typescript from '@rollup/plugin-typescript';
import define from 'rollup-plugin-define';
import resolve from '@rollup/plugin-node-resolve';
import postcss from 'rollup-plugin-postcss';
import autoprefixer from 'autoprefixer';
import { terser } from 'rollup-plugin-terser';
const path = require('path');
const pkg = require('./package.json');
const ENV_PROD = process.env.BUILD === 'production';
const output = () => {
const pkg = require(path.join(__dirname, `package.json`));
return [
{
file: `dist/index.umd.js`,
format: 'umd',
name: 'easepick',
sourcemap: false,
extend: true,
globals(id) {
if (/^@easepick\//.test(id)) {
return 'easepick';
}
return id;
}
},
{
file: `dist/index.esm.js`,
format: 'esm',
sourcemap: false,
extend: true,
},
];
}
const input = (name) => {
return `src/index.ts`;
}
const getPackageConfig = (name) => {
return {
input: input(name),
output: output(name),
plugins: [
define({
replacements: {
__VERSION__: JSON.stringify(pkg.version),
}
}),
resolve({
resolveOnly: [/^@easepick\/.*$/]
}),
typescript({
tsconfig: `tsconfig.json`,
outputToFilesystem: false,
}),
postcss({
extract: 'index.css',
plugins: [autoprefixer],
minimize: ENV_PROD,
}),
ENV_PROD && terser(),
],
external(id) {
return /^@easepick\//.test(id);
}
};
}
export default [
getPackageConfig(),
]