-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.mjs
60 lines (59 loc) · 1.84 KB
/
rollup.config.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import commonjs from "@rollup/plugin-commonjs";
import { fileCache, httpResolve } from "@masx200/rollup-plugin-http-resolve";
import alias from "@rollup/plugin-alias";
import { getBabelOutputPlugin } from "@rollup/plugin-babel";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import fs from "fs";
import { defineConfig } from "rollup";
import esbuild from "rollup-plugin-esbuild";
const plugins = [
commonjs(),
json(),
nodeResolve(),
alias({
entries: JSON.parse(
(await fs.promises.readFile("./import_map.json")).toString(),
).imports,
}),
httpResolve({ cache: new fileCache() }),
getBabelOutputPlugin({
plugins: ["@babel/plugin-proposal-logical-assignment-operators"],
}),
esbuild({
// All options are optional
include: [/\.[jt]sx?$/, /^https?:\/\//], // default, inferred from `loaders` option
exclude: /node_modules/, // default
sourceMap: true, // default
minify: true,
target: "esnext", // default, or 'es20XX', 'esnext'
jsx: "preserve", // default, or 'preserve'
jsxFactory: "React.createElement",
jsxFragment: "React.Fragment",
// Like @rollup/plugin-replace
define: {},
tsconfig: "tsconfig.json", // default
// Add extra loaders
loaders: {},
}),
];
export default defineConfig([
{
input: "./build/src/getmarkdown[name].ts",
output: {
file: "./build/edge-functions/getmarkdown[name].js",
format: "esm",
sourcemap: true,
},
plugins,
},
{
input: "./build/src/getrss[name].ts",
output: {
file: "./build/edge-functions/getrss[name].js",
format: "esm",
sourcemap: true,
},
plugins,
},
]);