Fix asset path in build

This commit is contained in:
Pieter Vander Vennet 2023-01-17 18:49:15 +01:00
parent 3be24c1500
commit 93961e553f
2 changed files with 5 additions and 0 deletions

View file

@ -33,6 +33,9 @@ then
echo "Source maps are enabled" echo "Source maps are enabled"
fi fi
ASSET_URL="mc/$BRANCH"
export ASSET_URL
echo "$ASSET_URL"
export NODE_OPTIONS=--max-old-space-size=6500 export NODE_OPTIONS=--max-old-space-size=6500
vite build $SRC_MAPS vite build $SRC_MAPS

View file

@ -2,6 +2,7 @@ const { defineConfig } = require("vite")
import fs from "fs" import fs from "fs"
const allHtmlFiles = fs.readdirSync(".").filter((f) => f.endsWith(".html")) const allHtmlFiles = fs.readdirSync(".").filter((f) => f.endsWith(".html"))
const input = {} const input = {}
const ASSET_URL = process.env.ASSET_URL || ""
for (const html of allHtmlFiles) { for (const html of allHtmlFiles) {
const name = html.substring(0, html.length - 5) const name = html.substring(0, html.length - 5)
@ -14,6 +15,7 @@ module.exports = defineConfig({
input, input,
}, },
}, },
base: `${ASSET_URL}`,
server: { server: {
port: 1234, port: 1234,
}, },