-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
58 lines (55 loc) · 1.4 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
const { babel } = require("@rollup/plugin-babel");
const image = require("@rollup/plugin-image");
const { nodeResolve } = require("@rollup/plugin-node-resolve");
const commonjs = require("rollup-plugin-commonjs");
const postcss = require("rollup-plugin-postcss");
const packageJson = require("./package.json");
const { generateScopedName } = require("./src/plugins/polarisNamingStrategy");
const externalPackages = [
"react",
"classnames",
"react-autosize-textarea",
"react-is",
"prop-types",
"object-assign",
];
const extensions = [".js", ".jsx", ".ts", ".tsx"];
module.exports = [
{
external: (id) =>
externalPackages.includes(id) ||
id.includes("react-aria") ||
id.includes("react-stately"),
input: "src/index.ts",
plugins: [
nodeResolve({ extensions }),
babel({ babelHelpers: "bundled", extensions }),
commonjs({
namedExports: {
"react/jsx-runtime": ["jsx", "jsxs", "Fragment"],
},
}),
postcss({
modules: {
generateScopedName: generateScopedName({
prefix: "Polarwind",
extension: ".module.css",
}),
},
extract: "polarwind.css",
minimize: true,
}),
image(),
],
output: [
{
file: packageJson.module,
format: "esm",
},
{
file: packageJson.main,
format: "cjs",
},
],
},
];