-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
47 lines (45 loc) · 1.16 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
import pkg from "./package.json";
import babel from "@rollup/plugin-babel";
import postcss from "rollup-plugin-postcss";
import resolve from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
const deps = { ...pkg.dependencies };
const extensions = [".js", ".ts", ".d.ts"];
export default {
input: "src/index.ts", // our source file
preserveModules: true,
output: [
{
dir: pkg.module,
format: "esm",
sourcemap: true,
entryFileNames: "[name].js",
},
{
dir: pkg.main,
format: "cjs",
sourcemap: true,
entryFileNames: "[name].js",
},
],
external: Object.keys(deps),
plugins: [
resolve({ extensions, module: true }),
postcss({
// postfix with .module.css etc. for css modules (DISABLED)
modules: {
generateScopedName: "[name]__[local]___[hash:base64:5]",
},
autoModules: true,
namedExports: true,
// CSS cannot be extracted outside of the bundle directory for rollup v2.
extract: "index.css",
}),
babel({
extensions,
exclude: "node_modules/**",
babelHelpers: "bundled",
}),
terser(),
],
};