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

@ -4,7 +4,7 @@ FROM --platform=${BUILDPLATFORM} docker.io/node:16 as web-builder
COPY ./web /static/
ENV NODE_ENV=production
RUN cd /static && npm i && npm run build
RUN cd /static && npm i && npm run build-proxy
# Stage 2: Build
FROM docker.io/golang:1.17.3-bullseye AS builder

View File

@ -6,6 +6,7 @@
"scripts": {
"extract": "lingui extract",
"build": "lingui compile && rollup -c ./rollup.config.js",
"build-proxy": "lingui compile && rollup -c ./rollup.proxy.js",
"watch": "lingui compile && rollup -c -w",
"lint": "eslint . --max-warnings 0 --fix",
"lit-analyse": "lit-analyzer src",

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,9 +88,8 @@ const PLUGINS = [
isProdBuild && terser(),
].filter((p) => p);
export default [
// Polyfills (imported first)
{
// Polyfills (imported first)
export const POLY = {
input: "./poly.ts",
output: [
{
@ -112,7 +111,10 @@ export default [
watch: {
clearScreen: false,
},
},
};
export default [
POLY,
// Flow interface
{
input: "./src/interfaces/FlowInterface.ts",

3
web/rollup.proxy.js Normal file
View File

@ -0,0 +1,3 @@
import { POLY } from "./rollup.config";
export default [POLY];