annotate rollup.config.js @ 42:1d2c65d260d1

factor out breadcrumbs
author drewp@bigasterisk.com
date Thu, 05 Dec 2024 21:34:00 -0800
parents 3f2da406c788
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
drewp@bigasterisk.com
parents:
diff changeset
1 import builtins from "rollup-plugin-node-builtins";
drewp@bigasterisk.com
parents:
diff changeset
2 import commonjs from "@rollup/plugin-commonjs";
drewp@bigasterisk.com
parents:
diff changeset
3 import postcss from "rollup-plugin-postcss";
drewp@bigasterisk.com
parents:
diff changeset
4 import resolve from "@rollup/plugin-node-resolve";
drewp@bigasterisk.com
parents:
diff changeset
5 import typescript from "rollup-plugin-typescript2";
drewp@bigasterisk.com
parents:
diff changeset
6 import { terser } from "rollup-plugin-terser";
drewp@bigasterisk.com
parents:
diff changeset
7
drewp@bigasterisk.com
parents:
diff changeset
8 const workaround_jsonld_module_system_picker = "process = {version: '1.0.0'}";
drewp@bigasterisk.com
parents:
diff changeset
9 const workaround_some_browser_detector = "global = window";
drewp@bigasterisk.com
parents:
diff changeset
10
drewp@bigasterisk.com
parents:
diff changeset
11 const workaround_jsonld_expand_issue = {
drewp@bigasterisk.com
parents:
diff changeset
12 namedExports: {
drewp@bigasterisk.com
parents:
diff changeset
13 "../streamed-graph/node_modules/jsonld/lib/index.js": ["expand"], // fixes "expand is not exported by node_modules/jsonld/lib/index.js"
drewp@bigasterisk.com
parents:
diff changeset
14 },
drewp@bigasterisk.com
parents:
diff changeset
15 };
drewp@bigasterisk.com
parents:
diff changeset
16
drewp@bigasterisk.com
parents:
diff changeset
17 export default [
drewp@bigasterisk.com
parents:
diff changeset
18 {
drewp@bigasterisk.com
parents:
diff changeset
19 input: "src/index.ts",
drewp@bigasterisk.com
parents:
diff changeset
20 output: {
drewp@bigasterisk.com
parents:
diff changeset
21 file: "build/bundle.js",
drewp@bigasterisk.com
parents:
diff changeset
22 format: "esm",
drewp@bigasterisk.com
parents:
diff changeset
23 intro: `const ${workaround_some_browser_detector}, ${workaround_jsonld_module_system_picker};`,
drewp@bigasterisk.com
parents:
diff changeset
24 },
drewp@bigasterisk.com
parents:
diff changeset
25
drewp@bigasterisk.com
parents:
diff changeset
26 plugins: [
drewp@bigasterisk.com
parents:
diff changeset
27 builtins(),
drewp@bigasterisk.com
parents:
diff changeset
28 resolve({
drewp@bigasterisk.com
parents:
diff changeset
29 extensions: [".js", ".ts"],
drewp@bigasterisk.com
parents:
diff changeset
30 browser: true,
drewp@bigasterisk.com
parents:
diff changeset
31 }),
drewp@bigasterisk.com
parents:
diff changeset
32 typescript(),
drewp@bigasterisk.com
parents:
diff changeset
33 postcss({
drewp@bigasterisk.com
parents:
diff changeset
34 inject: false,
drewp@bigasterisk.com
parents:
diff changeset
35 }),
drewp@bigasterisk.com
parents:
diff changeset
36 commonjs(workaround_jsonld_expand_issue),
drewp@bigasterisk.com
parents:
diff changeset
37 //terser() // 1500 -> 500kB, but slow. put it in the docker builder only.
drewp@bigasterisk.com
parents:
diff changeset
38 ],
drewp@bigasterisk.com
parents:
diff changeset
39 },
drewp@bigasterisk.com
parents:
diff changeset
40 ];