forked from dockfries/infernus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
42 lines (38 loc) · 1.25 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 path from "node:path";
import { createRequire } from "node:module";
import esbuild from "rollup-plugin-esbuild";
import del from "rollup-plugin-delete";
import externals from "rollup-plugin-node-externals";
import dts from "rollup-plugin-dts";
import { typescriptPaths } from "rollup-plugin-typescript-paths";
import json from "@rollup/plugin-json";
const require = createRequire(import.meta.url);
const { compilerOptions } = require("./tsconfig.json");
const packagesDir = path.resolve("./packages");
const packageDir = path.resolve(packagesDir, process.env.TARGET);
const inputPath = path.resolve(packageDir, `src/main.ts`);
const outputPath = path.resolve(packageDir, `dist`);
export default [
{
input: inputPath,
output: [
{ file: outputPath + "/bundle.js", format: "cjs" },
{ file: outputPath + "/bundle.mjs", format: "es" },
],
plugins: [
del({ targets: outputPath + "/*" }),
esbuild({ target: "node16.13", minify: true }),
typescriptPaths({ preserveExtensions: true }),
externals(),
json(),
],
},
{
input: inputPath,
output: [{ file: outputPath + "/bundle.d.ts" }],
plugins: [
dts({ compilerOptions: { paths: compilerOptions.paths } }),
externals(),
],
},
];