-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.cjs
63 lines (60 loc) · 1.45 KB
/
rollup.config.cjs
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
const peerDepsExternal = require("rollup-plugin-peer-deps-external");
const resolve = require("@rollup/plugin-node-resolve");
const commonjs = require("@rollup/plugin-commonjs");
const typescript = require("rollup-plugin-typescript2");
const postcss = require("rollup-plugin-postcss");
const copy = require("rollup-plugin-copy");
const json = require("@rollup/plugin-json");
const path = require("path");
const packageJson = require("./package.json");
const outputDir = "dist";
const postcssOptions = () => ({
extensions: [".scss"],
extract: false,
minimize: true,
use: {
stylus: undefined,
less: undefined,
sass: {
includePaths: [
"./node_modules",
// This is only needed because we're using a local module. :-/
// Normally, you would not need this line.
path.resolve(__dirname, "..", "node_modules"),
],
},
},
});
module.exports = {
input: "./src/index.ts",
output: [
{
file: packageJson.main,
format: "cjs",
sourcemap: true,
},
{
file: packageJson.module,
format: "esm",
sourcemap: true,
},
],
plugins: [
peerDepsExternal(),
resolve({ preferBuiltins: true }),
commonjs(),
typescript({
exclude: ["src/stories/**/*.*"],
}),
postcss(postcssOptions()),
json(),
copy({
targets: [
{
src: "src/styles/GridTheme.scss",
dest: `${outputDir}`,
},
],
}),
],
};