-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.ts
58 lines (55 loc) · 1.41 KB
/
rollup.config.ts
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
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";
import { defineConfig } from "rollup";
import postcss from "rollup-plugin-postcss";
import type { InputPluginOption } from "rollup";
const plugins = [
typescript({
tsconfig: "./tsconfig.build.json",
}),
nodeResolve({
extensions: [".js", ".jsx", ".ts", ".tsx"],
}),
json(),
commonjs(),
{
name: "clean",
transform: (code) =>
code
.replace(/\n?^\s*\/\/ @ts-.+$/gm, "")
.replace(/\n?^\s*\/\/\/ <reference.+$/gm, "")
.replace(/\n?^\s*(\/\/|\/\*) eslint-disable.+$/gm, ""),
},
] satisfies InputPluginOption;
export default defineConfig([
{
input: "src/index.ts",
output: {
file: "dist/index.js",
format: "iife",
},
plugins: [
...plugins,
postcss({
inject: true,
// Disable Dart Sass deprecated legacy JS API warning until rollup-plugin-postcss is updated
// to support modern Sass API: https://github.com/egoist/rollup-plugin-postcss/issues/463
use: {
sass: {
silenceDeprecations: ["legacy-js-api"],
},
} as never,
}),
],
},
{
input: "src/mac-server.ts",
output: {
file: "dist/mac-server.cjs",
format: "cjs",
},
plugins,
},
]);