first row
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
const fs = require("fs")
|
||||
|
||||
const { copy } = require("esbuild-plugin-copy")
|
||||
const resolvePlugin = {
|
||||
name: "resolvePlugin",
|
||||
setup(build) {
|
||||
let path = require("path")
|
||||
// url in css does not resolve via esbuild-svelte correctly
|
||||
build.onResolve({ filter: /.*/, namespace: "fakecss" }, (args) => {
|
||||
// console.log(args)
|
||||
if (args.path.match(/^\./)) return { path: path.dirname(args.importer) + "/" + args.path }
|
||||
// return { path: path.join(args.resolveDir, "public", args.path) }
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -36,10 +33,11 @@ const esbuildSvelte = sveltePlugin({
|
||||
dev: (process.argv?.length > 2 ? process.argv[2] : "build") !== "build",
|
||||
},
|
||||
preprocess: svelteConfig.preprocess,
|
||||
cache: true,
|
||||
cache: false,
|
||||
filterWarnings: (warning) => {
|
||||
// filter out a11y
|
||||
if (warning.code.match(/^a11y/)) return false
|
||||
if (warning.code === "element_invalid_self_closing_tag") return false
|
||||
return true
|
||||
},
|
||||
})
|
||||
@@ -54,7 +52,18 @@ const options = {
|
||||
minify: process.argv[2] == "build",
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
plugins: [esbuildSvelte, resolvePlugin],
|
||||
plugins: [
|
||||
esbuildSvelte,
|
||||
resolvePlugin,
|
||||
copy({
|
||||
assets: {
|
||||
from: "./frontend/serviceworker.js",
|
||||
to: "service-worker.js",
|
||||
},
|
||||
}),
|
||||
],
|
||||
mainFields: ["svelte", "browser", "module", "main"],
|
||||
conditions: ["svelte", "browser"],
|
||||
loader: {
|
||||
".woff2": "file",
|
||||
".woff": "file",
|
||||
@@ -73,19 +82,6 @@ if (process.argv[2] == "start") {
|
||||
const dotEnv = fs.readFileSync(__dirname + "/.env", "utf8")
|
||||
const TIBI_NAMESPACE = dotEnv.match(/TIBI_NAMESPACE=(.*)/)[1]
|
||||
const apiBase = process.env.API_BASE || "http://localhost:8080/api/v1/_/" + TIBI_NAMESPACE
|
||||
console.log("APIBASE;;", apiBase, "process", process.env.SSR)
|
||||
|
||||
bsMiddleware.push(
|
||||
createProxyMiddleware({
|
||||
pathFilter: "/_s",
|
||||
target: "https://sentry.basehosts.de",
|
||||
changeOrigin: true,
|
||||
logLevel: "debug",
|
||||
pathRewrite: (path, req) => {
|
||||
return path.replace(/^\/_s(.*)$/, "/api/5/envelope/")
|
||||
},
|
||||
})
|
||||
)
|
||||
bsMiddleware.push(
|
||||
createProxyMiddleware({
|
||||
pathFilter: "/api",
|
||||
@@ -95,24 +91,6 @@ if (process.argv[2] == "start") {
|
||||
logLevel: "debug",
|
||||
})
|
||||
)
|
||||
if (process.env.SSR) {
|
||||
bsMiddleware.push(
|
||||
createProxyMiddleware({
|
||||
pathFilter: function (path, req) {
|
||||
console.log("filter", path)
|
||||
return !path.match(/\./)
|
||||
},
|
||||
target: apiBase,
|
||||
changeOrigin: true,
|
||||
logLevel: "debug",
|
||||
pathRewrite: function (path, req) {
|
||||
console.log("rewirte")
|
||||
console.log(path)
|
||||
return "/ssr?url=" + encodeURIComponent(path)
|
||||
},
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
@@ -121,7 +99,7 @@ module.exports = {
|
||||
options: options,
|
||||
distDir,
|
||||
watch: {
|
||||
path: [__dirname + "/" + frontendDir + "/src/**/*"],
|
||||
path: [__dirname + "/" + frontendDir + "/src"],
|
||||
},
|
||||
serve: {
|
||||
onRequest(args) {
|
||||
@@ -140,6 +118,7 @@ module.exports = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
ghostMode: false,
|
||||
open: false,
|
||||
// logLevel: "debug",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user