-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
42 lines (39 loc) · 1.19 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
import fs from 'fs';
import path from 'path';
import typescript from "@rollup/plugin-typescript"
import json from '@rollup/plugin-json';
import resolve from "@rollup/plugin-node-resolve"
const packages = path.resolve(process.cwd(), 'packages/@depanlz');
const packageDir = fs.readdirSync(packages);
function output(pkg) {
return [
{
input: [`./packages/@depanlz/${pkg}/src/index.ts`],
output: [
{
file: `./packages/@depanlz/${pkg}/dist/index.cjs`,
format: 'cjs',
},
{
file: `./packages/@depanlz/${pkg}/dist/index.mjs`,
format: 'esm',
}
],
plugins: [
typescript({
compilerOptions: {
declarationDir: `./packages/@depanlz/${pkg}/dist/`
}
}),
json(),
resolve()
],
external: [
"@depanlz/core",
"@depanlz/web-server",
]
}
];
}
const config = packageDir.map((item) =>output(item)).flat()
export default config