-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
46 lines (45 loc) · 1.3 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
import babel from "@rollup/plugin-babel";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import autoprefixer from "autoprefixer";
import cssimport from "postcss-import";
import postcss from "rollup-plugin-postcss";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
export default [
{
input: "./src/index.ts", // 진입 경로
output: [
{
file: "./dist/esm/bundle.js", // 빌드 파일 저장 경로
format: "es", // 출력 형식
sourcemap: true, // 디버깅 유용
},
{
file: "./dist/bundle.js",
format: "cjs",
sourcemap: true,
},
],
external: ["react-aria", "clsx"], // 외부 종속성
plugins: [
// 바벨 트랜스파일러 설정
babel({
babelHelpers: "bundled",
presets: ["@babel/preset-env", "@babel/preset-react"],
extensions: [".js", ".jsx", ".ts", ".tsx"],
}),
peerDepsExternal(),
typescript(),
postcss({
plugins: [cssimport(), autoprefixer()],
}),
],
},
{
// 타입 declation 위치
input: "./dist/dts/src/index.d.ts",
output: [{ file: "dist/index.d.ts", format: "es" }],
external: [/\.css$/], // css파일이 존재할 경우, 추가
plugins: [dts()],
},
];