This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
rollup.config.js
70 lines (69 loc) · 1.65 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import json from "@rollup/plugin-json";
import replace from "@rollup/plugin-replace";
import { importMetaAssets } from "@web/rollup-plugin-import-meta-assets";
import path from "path";
import autoExternals from "rollup-plugin-auto-external";
import postcss from "rollup-plugin-postcss";
import { terser } from "rollup-plugin-terser";
import { swc } from "rollup-plugin-swc3";
import packageJson from "./package.json";
export default {
input: "src/index.ts",
output: [
{
dir: path.dirname(packageJson.main),
format: "cjs",
exports: "named",
sourcemap: true,
name: "app-services-ui-components",
preserveModules: true,
preserveModulesRoot: "src",
},
{
dir: path.dirname(packageJson.module),
format: "esm",
exports: "named",
sourcemap: true,
preserveModules: true,
preserveModulesRoot: "src",
},
],
external: [
"react/jsx-runtime",
"@swc/helpers/lib/_extends.js",
"@patternfly/react-styles",
"@patternfly/react-tokens",
],
plugins: [
autoExternals(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
preventAssignment: true,
}),
json(),
swc({
sourceMaps: true,
jsc: {
parser: {
syntax: "typescript",
},
transform: {
react: {
runtime: "automatic",
},
},
externalHelpers: true,
},
}),
postcss({
extract: true,
minimize: true,
}),
importMetaAssets(),
terser(),
],
onwarn: (warning) => {
// better fail on warnings
throw new Error("Warning as error: " + warning.message);
},
};