-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
54 lines (52 loc) · 1.86 KB
/
rollup.config.ts
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
import peerDepsExternal from "rollup-plugin-peer-deps-external"
import typescript from "rollup-plugin-typescript2"
import postcss from "rollup-plugin-postcss"
import packageJson from "./package.json"
import { terser } from "rollup-plugin-terser"
import progress from "rollup-plugin-progress"
import { visualizer } from "rollup-plugin-visualizer"
import autoprefixer from "autoprefixer"
import copy from "rollup-plugin-copy"
import url from "@rollup/plugin-url"
//https://www.codefeetime.com/post/rollup-config-for-react-component-library-with-typescript-scss/
//https://github.com/egoist/rollup-plugin-postcss/issues/385
// eslint-disable-next-line import/no-anonymous-default-export
export default [
{
input: ["src/index.ts"],
output: [
{
dir: "dist",
format: "cjs",
exports: "auto",
sourcemap: false
}
],
preserveModules: true,
plugins: [
progress(),
copy({
targets: [{ src: "src/assets/img/*", dest: "dist/assets/img" }]
}),
url(),
peerDepsExternal(),
typescript({ useTsconfigDeclarationDir: true }),
// -- Works ---
postcss({
extract: true,
minimize: true,
modules: true,
plugins: [autoprefixer()]
}),
// sass({
// options:{
// data: `@import "src/style/variables.scss";`,
// processor: css => postcss({plugins:[autoprefixer], modules:true, inject:true}).process(css).then(result => result.css)
// }
// }),
terser(),
visualizer({})
],
external: [...Object.keys(packageJson.peerDependencies || {}), ...Object.keys(packageJson.dependencies || {})]
}
]