-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
39 lines (36 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
/* eslint node/no-unsupported-features/es-syntax: ["error", { ignores: ["modules"] }] */
import babel from "@rollup/plugin-babel";
import commonjs from "@rollup/plugin-commonjs";
import dts from "rollup-plugin-dts";
import externals from "rollup-plugin-node-externals";
import json from "@rollup/plugin-json";
import replace from "@rollup/plugin-replace";
import resolve from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";
import pkg from "./package.json";
const extensions = [".ts", ".mjs", ".js", ".json"];
export default [
// Bundle
{
input: "src/index.ts",
output: [
{ format: "cjs", file: pkg.main },
{ format: "es", file: pkg.module },
],
plugins: [
externals({ deps: true }),
replace({ "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV) }),
json(),
resolve({ preferBuiltins: true, extensions }),
commonjs(),
typescript(),
babel({ babelHelpers: "bundled", extensions }),
],
},
// Declaration
{
input: "src/index.ts",
output: { format: "es", file: pkg.types },
plugins: [externals({ deps: true }), dts({ respectExternal: true })],
},
];