-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
47 lines (44 loc) · 1.04 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 alias from "@rollup/plugin-alias";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import rollupTypescript from "rollup-plugin-typescript2";
import terser from "@rollup/plugin-terser";
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const pkg = require("./package.json");
const aliasConfig = {
entries: [{ find: "@", replacement: "./src" }],
};
/**
* @type {import('rollup').RollupOptions}
*/
export default {
input: "src/index.ts",
output: [
// 输出 commonjs 规范的全量包
{
file: pkg.main,
format: "cjs",
},
// 输出 es 规范的代码全量包
{
file: pkg.module,
format: "es",
},
// 输出 umd 规范的代码全量包
{
name: "utils",
file: pkg.browser,
format: "umd",
},
],
plugins: [
alias(aliasConfig),
json(),
nodeResolve(),
commonjs(),
rollupTypescript(),
terser(),
],
};