-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
89 lines (85 loc) · 2.01 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import vue from 'rollup-plugin-vue';
import alias from '@rollup/plugin-alias';
import babel from 'rollup-plugin-babel';
import typescript from 'rollup-plugin-typescript2';
import cleanup from 'rollup-plugin-cleanup';
import { visualizer } from 'rollup-plugin-visualizer';
import css from 'rollup-plugin-css-only'
const packageJson = require('./package.json');
const baseConfig = {
input: 'src/index.ts',
// external: [
// ...Object.keys(packageJson.dependencies),
// ...Object.keys(packageJson.peerDependencies),
// /^lodash\/.*/,
// ],
};
const buildFormats = [
{
...baseConfig,
output: {
file: packageJson.module,
format: 'esm',
sourcemap: true,
},
plugins: [
typescript({
tsconfigOverride: {
include: null,
exclude: ['node_modules', 'tests', 'dev'],
},
}),
alias({
resolve: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
}),
css({
output: 'bundle.css'
}),
vue({
css: false,
template: {
isProduction: true,
},
}),
babel({
exclude: 'node_modules/**',
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
}),
cleanup({ extensions: ['js', 'ts', 'jsx', 'tsx', 'vue'] }),
visualizer({ open: false }),
],
},
{
...baseConfig,
output: {
file: packageJson.main,
format: 'cjs',
sourcemap: true,
},
plugins: [
typescript({
tsconfigOverride: {
include: null,
exclude: ['node_modules', 'tests', 'dev'],
target: 'ES5',
},
}),
alias({
resolve: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
}),
css(),
vue({
css: false,
template: {
isProduction: true,
},
}),
babel({
exclude: 'node_modules/**',
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
}),
cleanup({ extensions: ['js', 'ts', 'jsx', 'tsx', 'vue'] }),
],
},
];
export default buildFormats;