-
Notifications
You must be signed in to change notification settings - Fork 10
/
rollup.config.server.mjs
36 lines (35 loc) · 1.11 KB
/
rollup.config.server.mjs
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
import babel from "@rollup/plugin-babel";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import terser from "@rollup/plugin-terser";
import json from "@rollup/plugin-json";
import generatePackageJson from "@lomray/rollup-plugin-generate-package-json-v2";
import pkg from "./package.json" assert { type: "json" };
export default {
input: ["src/server/index.js", "src/query.js"],
output: [
{ dir: "dist/server/index.cjs.js", format: "cjs", sourcemap: true },
{ dir: "dist/server/index.esm.js", format: "esm", sourcemap: true },
],
plugins: [
babel({
babelHelpers: "bundled",
exclude: "node_modules/**",
}),
json(),
resolve({ preferBuiltins: false }),
commonjs({ preferBuiltins: false }),
terser(),
generatePackageJson({
baseContents: (pkg) => ({
name: pkg.name,
version: pkg.version,
main: "index.cjs.js",
module: "index.esm.js",
dependencies: { "node-fetch": "^3.3.1" },
}),
outputFolder: "dist/server",
}),
],
external: Object.keys(pkg.peerDependencies),
};