-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.js
More file actions
39 lines (39 loc) · 1.03 KB
/
rollup.config.js
File metadata and controls
39 lines (39 loc) · 1.03 KB
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
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser";
import run from "@rollup/plugin-run";
import typescript from "@rollup/plugin-typescript";
import builtins from "builtin-modules";
import json from "@rollup/plugin-json";
import rimraf from "rimraf";
import polyfill from "rollup-plugin-node-polyfills";
const production = !process.env.ROLLUP_WATCH;
import fs from "fs";
import path from "path";
const pkg = JSON.parse(
fs.readFileSync(path.resolve("./package.json"), "utf-8")
);
const external = Object.keys(pkg.dependencies || []);
import { config } from "dotenv";
config();
rimraf.sync("./dist");
export default {
input: process.env.ENTRYPOINT,
output: {
dir: "dist",
format: "cjs"
},
external: [...builtins, ...external],
plugins: [
commonjs(),
resolve(),
polyfill(),
json(),
typescript({
noEmitOnError: false,
tsconfig: "tsconfig.json"
}),
// production && terser(),
!production && run()
]
};