web: add rollup config for proxy outpost

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-11-26 14:18:51 +01:00
parent 03e0eecb1d
commit b58875d4c7
4 changed files with 35 additions and 29 deletions

View File

@ -10,7 +10,7 @@ import { terser } from "rollup-plugin-terser";
const extensions = [".js", ".jsx", ".ts", ".tsx"];
const resources = [
export const resources = [
{ src: "node_modules/rapidoc/dist/rapidoc-min.js", dest: "dist/" },
{
@ -44,12 +44,12 @@ const resources = [
];
// eslint-disable-next-line no-undef
const isProdBuild = process.env.NODE_ENV === "production";
export const isProdBuild = process.env.NODE_ENV === "production";
// eslint-disable-next-line no-undef
const apiBasePath = process.env.AK_API_BASE_PATH || "";
export const apiBasePath = process.env.AK_API_BASE_PATH || "";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function manualChunks(id) {
export function manualChunks(id) {
if (id.endsWith(".md")) {
return "docs";
}
@ -69,7 +69,7 @@ function manualChunks(id) {
}
}
const PLUGINS = [
export const PLUGINS = [
cssimport(),
markdown(),
nodeResolve({ extensions, browser: true }),
@ -88,31 +88,33 @@ const PLUGINS = [
isProdBuild && terser(),
].filter((p) => p);
export default [
// Polyfills (imported first)
{
input: "./poly.ts",
output: [
{
format: "iife",
file: "dist/poly.js",
sourcemap: true,
},
],
plugins: [
cssimport(),
nodeResolve({ browser: true }),
commonjs(),
isProdBuild && terser(),
copy({
targets: [...resources],
copyOnce: false,
}),
].filter((p) => p),
watch: {
clearScreen: false,
// Polyfills (imported first)
export const POLY = {
input: "./poly.ts",
output: [
{
format: "iife",
file: "dist/poly.js",
sourcemap: true,
},
],
plugins: [
cssimport(),
nodeResolve({ browser: true }),
commonjs(),
isProdBuild && terser(),
copy({
targets: [...resources],
copyOnce: false,
}),
].filter((p) => p),
watch: {
clearScreen: false,
},
};
export default [
POLY,
// Flow interface
{
input: "./src/interfaces/FlowInterface.ts",