forked from TyperClub/electron-request
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
43 lines (40 loc) · 1 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
import isBuiltin from 'is-builtin-module';
import typescript from 'rollup-plugin-typescript2';
import typescriptPaths from 'rollup-plugin-typescript-paths';
import dts from 'rollup-plugin-dts';
import pkgConfig from './package.json';
const resolveTypescriptPaths = () =>
typescriptPaths({
preserveExtensions: true,
});
const external = (id) => {
if (isBuiltin(id)) {
return true;
}
return Reflect.has(pkgConfig.dependencies || {}, id);
};
export default [
{
input: 'src/index.ts',
plugins: [resolveTypescriptPaths(), typescript()],
output: [
{ file: pkgConfig.module, format: 'es' },
{ file: pkgConfig.main, format: 'cjs', exports: 'auto' },
],
external,
},
{
input: 'src/index.ts',
plugins: [
resolveTypescriptPaths(),
dts({
respectExternal: true,
compilerOptions: {
removeComments: false,
},
}),
],
output: [{ file: pkgConfig.types, format: 'es' }],
external: (id) => isBuiltin(id),
},
];