web: add rollup config for proxy outpost
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
03e0eecb1d
commit
b58875d4c7
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import { POLY } from "./rollup.config";
|
||||
|
||||
export default [POLY];
|
Reference in New Issue