-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
42 lines (40 loc) · 1.34 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 postcss from "rollup-plugin-postcss";
import { terser } from "rollup-plugin-terser";
import typescript from "@wessberg/rollup-plugin-ts";
import packageJSON from "./package.json";
export default [
{
input: "./src/index.ts",
output: [
{
file: packageJSON.main,
format: "cjs",
sourcemap: true
},
{
file: packageJSON.module,
format: "es",
exports: "named",
sourcemap: true
}
],
external: [
// ensure peer dependencies are declared as externals
...Object.keys(packageJSON.peerDependencies),
// same for actual dependencies, to allow for dependency resolution/de-duplication by consumers
...Object.keys(packageJSON.dependencies)
],
plugins: [
// collect styles from SCSS, minimise them and include them in the JS module (i.e. not as separate .css file)
postcss({
extract: false,
extensions: [".scss"],
minimize: true
}),
// compile typescript into vanilla javascript and produce a single .d.ts file
typescript({}),
// discard unused parts of the code
terser()
]
}
];