-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
41 lines (33 loc) · 1.07 KB
/
rollup.config.js
File metadata and controls
41 lines (33 loc) · 1.07 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
import { builtinModules } from 'node:module';
import { tmpdir } from 'node:os';
import { join as pathJoin } from 'node:path';
import typescript from 'rollup-plugin-typescript2';
import pkg from './package.json';
const cacheRoot = pathJoin(tmpdir(), '.rpt2_cache');
const CORE_MODULE_RE = /(^_|\/)/;
const coreModules = builtinModules.filter(name => !CORE_MODULE_RE.test(name));
const src = pathJoin(__dirname, 'src');
const lib = pathJoin(__dirname, 'lib');
export default [
{
input: pathJoin(src, 'index.ts'),
plugins: [
typescript({
cacheRoot,
declarationDir: lib,
tsconfigOverride: {
outDir: lib,
rootDir: src,
include: [src],
},
}),
],
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {}), ...coreModules],
output: [
{
file: pathJoin(lib, 'index.mjs'),
format: 'esm',
},
],
},
];